intel_crt.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. /*
  2. * Copyright © 2006-2007 Intel Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. * DEALINGS IN THE SOFTWARE.
  22. *
  23. * Authors:
  24. * Eric Anholt <eric@anholt.net>
  25. */
  26. #include <linux/i2c.h>
  27. #include "drmP.h"
  28. #include "drm.h"
  29. #include "drm_crtc.h"
  30. #include "drm_crtc_helper.h"
  31. #include "intel_drv.h"
  32. #include "i915_drm.h"
  33. #include "i915_drv.h"
  34. static void intel_crt_dpms(struct drm_encoder *encoder, int mode)
  35. {
  36. struct drm_device *dev = encoder->dev;
  37. struct drm_i915_private *dev_priv = dev->dev_private;
  38. u32 temp, reg;
  39. if (IS_IGDNG(dev))
  40. reg = PCH_ADPA;
  41. else
  42. reg = ADPA;
  43. temp = I915_READ(reg);
  44. temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE);
  45. temp &= ~ADPA_DAC_ENABLE;
  46. switch(mode) {
  47. case DRM_MODE_DPMS_ON:
  48. temp |= ADPA_DAC_ENABLE;
  49. break;
  50. case DRM_MODE_DPMS_STANDBY:
  51. temp |= ADPA_DAC_ENABLE | ADPA_HSYNC_CNTL_DISABLE;
  52. break;
  53. case DRM_MODE_DPMS_SUSPEND:
  54. temp |= ADPA_DAC_ENABLE | ADPA_VSYNC_CNTL_DISABLE;
  55. break;
  56. case DRM_MODE_DPMS_OFF:
  57. temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
  58. break;
  59. }
  60. I915_WRITE(reg, temp);
  61. if (IS_IGD(dev)) {
  62. if (mode == DRM_MODE_DPMS_OFF) {
  63. /* turn off DAC */
  64. temp = I915_READ(PORT_HOTPLUG_EN);
  65. temp &= ~CRT_EOS_INT_EN;
  66. I915_WRITE(PORT_HOTPLUG_EN, temp);
  67. temp = I915_READ(PORT_HOTPLUG_STAT);
  68. if (temp & CRT_EOS_INT_STATUS)
  69. I915_WRITE(PORT_HOTPLUG_STAT,
  70. CRT_EOS_INT_STATUS);
  71. } else {
  72. /* turn on DAC. EOS interrupt must be enabled after DAC
  73. * is enabled, so it sounds not good to enable it in
  74. * i915_driver_irq_postinstall()
  75. * wait 12.5ms after DAC is enabled
  76. */
  77. msleep(13);
  78. temp = I915_READ(PORT_HOTPLUG_STAT);
  79. if (temp & CRT_EOS_INT_STATUS)
  80. I915_WRITE(PORT_HOTPLUG_STAT,
  81. CRT_EOS_INT_STATUS);
  82. temp = I915_READ(PORT_HOTPLUG_EN);
  83. temp |= CRT_EOS_INT_EN;
  84. I915_WRITE(PORT_HOTPLUG_EN, temp);
  85. }
  86. }
  87. }
  88. static int intel_crt_mode_valid(struct drm_connector *connector,
  89. struct drm_display_mode *mode)
  90. {
  91. struct drm_device *dev = connector->dev;
  92. int max_clock = 0;
  93. if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
  94. return MODE_NO_DBLESCAN;
  95. if (mode->clock < 25000)
  96. return MODE_CLOCK_LOW;
  97. if (!IS_I9XX(dev))
  98. max_clock = 350000;
  99. else
  100. max_clock = 400000;
  101. if (mode->clock > max_clock)
  102. return MODE_CLOCK_HIGH;
  103. return MODE_OK;
  104. }
  105. static bool intel_crt_mode_fixup(struct drm_encoder *encoder,
  106. struct drm_display_mode *mode,
  107. struct drm_display_mode *adjusted_mode)
  108. {
  109. return true;
  110. }
  111. static void intel_crt_mode_set(struct drm_encoder *encoder,
  112. struct drm_display_mode *mode,
  113. struct drm_display_mode *adjusted_mode)
  114. {
  115. struct drm_device *dev = encoder->dev;
  116. struct drm_crtc *crtc = encoder->crtc;
  117. struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
  118. struct drm_i915_private *dev_priv = dev->dev_private;
  119. int dpll_md_reg;
  120. u32 adpa, dpll_md;
  121. u32 adpa_reg;
  122. if (intel_crtc->pipe == 0)
  123. dpll_md_reg = DPLL_A_MD;
  124. else
  125. dpll_md_reg = DPLL_B_MD;
  126. if (IS_IGDNG(dev))
  127. adpa_reg = PCH_ADPA;
  128. else
  129. adpa_reg = ADPA;
  130. /*
  131. * Disable separate mode multiplier used when cloning SDVO to CRT
  132. * XXX this needs to be adjusted when we really are cloning
  133. */
  134. if (IS_I965G(dev) && !IS_IGDNG(dev)) {
  135. dpll_md = I915_READ(dpll_md_reg);
  136. I915_WRITE(dpll_md_reg,
  137. dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK);
  138. }
  139. adpa = 0;
  140. if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
  141. adpa |= ADPA_HSYNC_ACTIVE_HIGH;
  142. if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
  143. adpa |= ADPA_VSYNC_ACTIVE_HIGH;
  144. if (intel_crtc->pipe == 0) {
  145. adpa |= ADPA_PIPE_A_SELECT;
  146. if (!IS_IGDNG(dev))
  147. I915_WRITE(BCLRPAT_A, 0);
  148. } else {
  149. adpa |= ADPA_PIPE_B_SELECT;
  150. if (!IS_IGDNG(dev))
  151. I915_WRITE(BCLRPAT_B, 0);
  152. }
  153. I915_WRITE(adpa_reg, adpa);
  154. }
  155. static bool intel_igdng_crt_detect_hotplug(struct drm_connector *connector)
  156. {
  157. struct drm_device *dev = connector->dev;
  158. struct drm_i915_private *dev_priv = dev->dev_private;
  159. u32 adpa, temp;
  160. bool ret;
  161. temp = adpa = I915_READ(PCH_ADPA);
  162. adpa &= ~ADPA_DAC_ENABLE;
  163. I915_WRITE(PCH_ADPA, adpa);
  164. adpa &= ~ADPA_CRT_HOTPLUG_MASK;
  165. adpa |= (ADPA_CRT_HOTPLUG_PERIOD_128 |
  166. ADPA_CRT_HOTPLUG_WARMUP_10MS |
  167. ADPA_CRT_HOTPLUG_SAMPLE_4S |
  168. ADPA_CRT_HOTPLUG_VOLTAGE_50 | /* default */
  169. ADPA_CRT_HOTPLUG_VOLREF_325MV |
  170. ADPA_CRT_HOTPLUG_ENABLE |
  171. ADPA_CRT_HOTPLUG_FORCE_TRIGGER);
  172. DRM_DEBUG("pch crt adpa 0x%x", adpa);
  173. I915_WRITE(PCH_ADPA, adpa);
  174. while ((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) != 0)
  175. ;
  176. /* Check the status to see if both blue and green are on now */
  177. adpa = I915_READ(PCH_ADPA);
  178. adpa &= ADPA_CRT_HOTPLUG_MONITOR_MASK;
  179. if ((adpa == ADPA_CRT_HOTPLUG_MONITOR_COLOR) ||
  180. (adpa == ADPA_CRT_HOTPLUG_MONITOR_MONO))
  181. ret = true;
  182. else
  183. ret = false;
  184. /* restore origin register */
  185. I915_WRITE(PCH_ADPA, temp);
  186. return ret;
  187. }
  188. /**
  189. * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect CRT presence.
  190. *
  191. * Not for i915G/i915GM
  192. *
  193. * \return true if CRT is connected.
  194. * \return false if CRT is disconnected.
  195. */
  196. static bool intel_crt_detect_hotplug(struct drm_connector *connector)
  197. {
  198. struct drm_device *dev = connector->dev;
  199. struct drm_i915_private *dev_priv = dev->dev_private;
  200. u32 hotplug_en;
  201. int i, tries = 0;
  202. if (IS_IGDNG(dev))
  203. return intel_igdng_crt_detect_hotplug(connector);
  204. /*
  205. * On 4 series desktop, CRT detect sequence need to be done twice
  206. * to get a reliable result.
  207. */
  208. if (IS_G4X(dev) && !IS_GM45(dev))
  209. tries = 2;
  210. else
  211. tries = 1;
  212. hotplug_en = I915_READ(PORT_HOTPLUG_EN);
  213. hotplug_en &= CRT_FORCE_HOTPLUG_MASK;
  214. hotplug_en |= CRT_HOTPLUG_FORCE_DETECT;
  215. if (IS_G4X(dev))
  216. hotplug_en |= CRT_HOTPLUG_ACTIVATION_PERIOD_64;
  217. hotplug_en |= CRT_HOTPLUG_VOLTAGE_COMPARE_50;
  218. for (i = 0; i < tries ; i++) {
  219. unsigned long timeout;
  220. /* turn on the FORCE_DETECT */
  221. I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
  222. timeout = jiffies + msecs_to_jiffies(1000);
  223. /* wait for FORCE_DETECT to go off */
  224. do {
  225. if (!(I915_READ(PORT_HOTPLUG_EN) &
  226. CRT_HOTPLUG_FORCE_DETECT))
  227. break;
  228. msleep(1);
  229. } while (time_after(timeout, jiffies));
  230. }
  231. if ((I915_READ(PORT_HOTPLUG_STAT) & CRT_HOTPLUG_MONITOR_MASK) ==
  232. CRT_HOTPLUG_MONITOR_COLOR)
  233. return true;
  234. return false;
  235. }
  236. static bool intel_crt_detect_ddc(struct drm_connector *connector)
  237. {
  238. struct intel_output *intel_output = to_intel_output(connector);
  239. /* CRT should always be at 0, but check anyway */
  240. if (intel_output->type != INTEL_OUTPUT_ANALOG)
  241. return false;
  242. return intel_ddc_probe(intel_output);
  243. }
  244. static enum drm_connector_status
  245. intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output)
  246. {
  247. struct drm_encoder *encoder = &intel_output->enc;
  248. struct drm_device *dev = encoder->dev;
  249. struct drm_i915_private *dev_priv = dev->dev_private;
  250. struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
  251. uint32_t pipe = intel_crtc->pipe;
  252. uint32_t save_bclrpat;
  253. uint32_t save_vtotal;
  254. uint32_t vtotal, vactive;
  255. uint32_t vsample;
  256. uint32_t vblank, vblank_start, vblank_end;
  257. uint32_t dsl;
  258. uint32_t bclrpat_reg;
  259. uint32_t vtotal_reg;
  260. uint32_t vblank_reg;
  261. uint32_t vsync_reg;
  262. uint32_t pipeconf_reg;
  263. uint32_t pipe_dsl_reg;
  264. uint8_t st00;
  265. enum drm_connector_status status;
  266. if (pipe == 0) {
  267. bclrpat_reg = BCLRPAT_A;
  268. vtotal_reg = VTOTAL_A;
  269. vblank_reg = VBLANK_A;
  270. vsync_reg = VSYNC_A;
  271. pipeconf_reg = PIPEACONF;
  272. pipe_dsl_reg = PIPEADSL;
  273. } else {
  274. bclrpat_reg = BCLRPAT_B;
  275. vtotal_reg = VTOTAL_B;
  276. vblank_reg = VBLANK_B;
  277. vsync_reg = VSYNC_B;
  278. pipeconf_reg = PIPEBCONF;
  279. pipe_dsl_reg = PIPEBDSL;
  280. }
  281. save_bclrpat = I915_READ(bclrpat_reg);
  282. save_vtotal = I915_READ(vtotal_reg);
  283. vblank = I915_READ(vblank_reg);
  284. vtotal = ((save_vtotal >> 16) & 0xfff) + 1;
  285. vactive = (save_vtotal & 0x7ff) + 1;
  286. vblank_start = (vblank & 0xfff) + 1;
  287. vblank_end = ((vblank >> 16) & 0xfff) + 1;
  288. /* Set the border color to purple. */
  289. I915_WRITE(bclrpat_reg, 0x500050);
  290. if (IS_I9XX(dev)) {
  291. uint32_t pipeconf = I915_READ(pipeconf_reg);
  292. I915_WRITE(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER);
  293. /* Wait for next Vblank to substitue
  294. * border color for Color info */
  295. intel_wait_for_vblank(dev);
  296. st00 = I915_READ8(VGA_MSR_WRITE);
  297. status = ((st00 & (1 << 4)) != 0) ?
  298. connector_status_connected :
  299. connector_status_disconnected;
  300. I915_WRITE(pipeconf_reg, pipeconf);
  301. } else {
  302. bool restore_vblank = false;
  303. int count, detect;
  304. /*
  305. * If there isn't any border, add some.
  306. * Yes, this will flicker
  307. */
  308. if (vblank_start <= vactive && vblank_end >= vtotal) {
  309. uint32_t vsync = I915_READ(vsync_reg);
  310. uint32_t vsync_start = (vsync & 0xffff) + 1;
  311. vblank_start = vsync_start;
  312. I915_WRITE(vblank_reg,
  313. (vblank_start - 1) |
  314. ((vblank_end - 1) << 16));
  315. restore_vblank = true;
  316. }
  317. /* sample in the vertical border, selecting the larger one */
  318. if (vblank_start - vactive >= vtotal - vblank_end)
  319. vsample = (vblank_start + vactive) >> 1;
  320. else
  321. vsample = (vtotal + vblank_end) >> 1;
  322. /*
  323. * Wait for the border to be displayed
  324. */
  325. while (I915_READ(pipe_dsl_reg) >= vactive)
  326. ;
  327. while ((dsl = I915_READ(pipe_dsl_reg)) <= vsample)
  328. ;
  329. /*
  330. * Watch ST00 for an entire scanline
  331. */
  332. detect = 0;
  333. count = 0;
  334. do {
  335. count++;
  336. /* Read the ST00 VGA status register */
  337. st00 = I915_READ8(VGA_MSR_WRITE);
  338. if (st00 & (1 << 4))
  339. detect++;
  340. } while ((I915_READ(pipe_dsl_reg) == dsl));
  341. /* restore vblank if necessary */
  342. if (restore_vblank)
  343. I915_WRITE(vblank_reg, vblank);
  344. /*
  345. * If more than 3/4 of the scanline detected a monitor,
  346. * then it is assumed to be present. This works even on i830,
  347. * where there isn't any way to force the border color across
  348. * the screen
  349. */
  350. status = detect * 4 > count * 3 ?
  351. connector_status_connected :
  352. connector_status_disconnected;
  353. }
  354. /* Restore previous settings */
  355. I915_WRITE(bclrpat_reg, save_bclrpat);
  356. return status;
  357. }
  358. static enum drm_connector_status intel_crt_detect(struct drm_connector *connector)
  359. {
  360. struct drm_device *dev = connector->dev;
  361. struct intel_output *intel_output = to_intel_output(connector);
  362. struct drm_encoder *encoder = &intel_output->enc;
  363. struct drm_crtc *crtc;
  364. int dpms_mode;
  365. enum drm_connector_status status;
  366. if (IS_I9XX(dev) && !IS_I915G(dev) && !IS_I915GM(dev)) {
  367. if (intel_crt_detect_hotplug(connector))
  368. return connector_status_connected;
  369. else
  370. return connector_status_disconnected;
  371. }
  372. if (intel_crt_detect_ddc(connector))
  373. return connector_status_connected;
  374. /* for pre-945g platforms use load detect */
  375. if (encoder->crtc && encoder->crtc->enabled) {
  376. status = intel_crt_load_detect(encoder->crtc, intel_output);
  377. } else {
  378. crtc = intel_get_load_detect_pipe(intel_output,
  379. NULL, &dpms_mode);
  380. if (crtc) {
  381. status = intel_crt_load_detect(crtc, intel_output);
  382. intel_release_load_detect_pipe(intel_output, dpms_mode);
  383. } else
  384. status = connector_status_unknown;
  385. }
  386. return status;
  387. }
  388. static void intel_crt_destroy(struct drm_connector *connector)
  389. {
  390. struct intel_output *intel_output = to_intel_output(connector);
  391. intel_i2c_destroy(intel_output->ddc_bus);
  392. drm_sysfs_connector_remove(connector);
  393. drm_connector_cleanup(connector);
  394. kfree(connector);
  395. }
  396. static int intel_crt_get_modes(struct drm_connector *connector)
  397. {
  398. int ret;
  399. struct intel_output *intel_output = to_intel_output(connector);
  400. struct i2c_adapter *ddcbus;
  401. struct drm_device *dev = connector->dev;
  402. ret = intel_ddc_get_modes(intel_output);
  403. if (ret || !IS_G4X(dev))
  404. goto end;
  405. ddcbus = intel_output->ddc_bus;
  406. /* Try to probe digital port for output in DVI-I -> VGA mode. */
  407. intel_output->ddc_bus =
  408. intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D");
  409. if (!intel_output->ddc_bus) {
  410. intel_output->ddc_bus = ddcbus;
  411. dev_printk(KERN_ERR, &connector->dev->pdev->dev,
  412. "DDC bus registration failed for CRTDDC_D.\n");
  413. goto end;
  414. }
  415. /* Try to get modes by GPIOD port */
  416. ret = intel_ddc_get_modes(intel_output);
  417. intel_i2c_destroy(ddcbus);
  418. end:
  419. return ret;
  420. }
  421. static int intel_crt_set_property(struct drm_connector *connector,
  422. struct drm_property *property,
  423. uint64_t value)
  424. {
  425. return 0;
  426. }
  427. /*
  428. * Routines for controlling stuff on the analog port
  429. */
  430. static const struct drm_encoder_helper_funcs intel_crt_helper_funcs = {
  431. .dpms = intel_crt_dpms,
  432. .mode_fixup = intel_crt_mode_fixup,
  433. .prepare = intel_encoder_prepare,
  434. .commit = intel_encoder_commit,
  435. .mode_set = intel_crt_mode_set,
  436. };
  437. static const struct drm_connector_funcs intel_crt_connector_funcs = {
  438. .dpms = drm_helper_connector_dpms,
  439. .detect = intel_crt_detect,
  440. .fill_modes = drm_helper_probe_single_connector_modes,
  441. .destroy = intel_crt_destroy,
  442. .set_property = intel_crt_set_property,
  443. };
  444. static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
  445. .mode_valid = intel_crt_mode_valid,
  446. .get_modes = intel_crt_get_modes,
  447. .best_encoder = intel_best_encoder,
  448. };
  449. static void intel_crt_enc_destroy(struct drm_encoder *encoder)
  450. {
  451. drm_encoder_cleanup(encoder);
  452. }
  453. static const struct drm_encoder_funcs intel_crt_enc_funcs = {
  454. .destroy = intel_crt_enc_destroy,
  455. };
  456. void intel_crt_init(struct drm_device *dev)
  457. {
  458. struct drm_connector *connector;
  459. struct intel_output *intel_output;
  460. struct drm_i915_private *dev_priv = dev->dev_private;
  461. u32 i2c_reg;
  462. intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
  463. if (!intel_output)
  464. return;
  465. connector = &intel_output->base;
  466. drm_connector_init(dev, &intel_output->base,
  467. &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
  468. drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs,
  469. DRM_MODE_ENCODER_DAC);
  470. drm_mode_connector_attach_encoder(&intel_output->base,
  471. &intel_output->enc);
  472. /* Set up the DDC bus. */
  473. if (IS_IGDNG(dev))
  474. i2c_reg = PCH_GPIOA;
  475. else {
  476. i2c_reg = GPIOA;
  477. /* Use VBT information for CRT DDC if available */
  478. if (dev_priv->crt_ddc_bus != -1)
  479. i2c_reg = dev_priv->crt_ddc_bus;
  480. }
  481. intel_output->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A");
  482. if (!intel_output->ddc_bus) {
  483. dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
  484. "failed.\n");
  485. return;
  486. }
  487. intel_output->type = INTEL_OUTPUT_ANALOG;
  488. intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
  489. (1 << INTEL_ANALOG_CLONE_BIT) |
  490. (1 << INTEL_SDVO_LVDS_CLONE_BIT);
  491. intel_output->crtc_mask = (1 << 0) | (1 << 1);
  492. connector->interlace_allowed = 0;
  493. connector->doublescan_allowed = 0;
  494. drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs);
  495. drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
  496. drm_sysfs_connector_add(connector);
  497. }