Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'common/fbdev-mipi' of master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6

+43 -51
+1 -38
arch/arm/mach-shmobile/board-ap4evb.c
··· 514 514 static struct sh_mipi_dsi_info mipidsi0_info = { 515 515 .data_format = MIPI_RGB888, 516 516 .lcd_chan = &lcdc_info.ch[0], 517 + .vsynw_offset = 17, 517 518 }; 518 519 519 520 static struct platform_device mipidsi0_device = { ··· 526 525 .platform_data = &mipidsi0_info, 527 526 }, 528 527 }; 529 - 530 - /* This function will disappear when we switch to (runtime) PM */ 531 - static int __init ap4evb_init_display_clk(void) 532 - { 533 - struct clk *lcdc_clk; 534 - struct clk *dsitx_clk; 535 - int ret; 536 - 537 - lcdc_clk = clk_get(&lcdc_device.dev, "sh_mobile_lcdc_fb.0"); 538 - if (IS_ERR(lcdc_clk)) 539 - return PTR_ERR(lcdc_clk); 540 - 541 - dsitx_clk = clk_get(&mipidsi0_device.dev, "sh-mipi-dsi.0"); 542 - if (IS_ERR(dsitx_clk)) { 543 - ret = PTR_ERR(dsitx_clk); 544 - goto eclkdsitxget; 545 - } 546 - 547 - ret = clk_enable(lcdc_clk); 548 - if (ret < 0) 549 - goto eclklcdcon; 550 - 551 - ret = clk_enable(dsitx_clk); 552 - if (ret < 0) 553 - goto eclkdsitxon; 554 - 555 - return 0; 556 - 557 - eclkdsitxon: 558 - clk_disable(lcdc_clk); 559 - eclklcdcon: 560 - clk_put(dsitx_clk); 561 - eclkdsitxget: 562 - clk_put(lcdc_clk); 563 - 564 - return ret; 565 - } 566 - device_initcall(ap4evb_init_display_clk); 567 528 568 529 static struct platform_device *qhd_devices[] __initdata = { 569 530 &mipidsi0_device,
+8 -5
arch/arm/mach-shmobile/clock-sh7372.c
··· 507 507 MSTP223, 508 508 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 509 509 MSTP329, MSTP328, MSTP323, MSTP322, MSTP314, MSTP313, MSTP312, 510 - MSTP415, MSTP413, MSTP411, MSTP410, MSTP406, MSTP403, 510 + MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP406, MSTP403, 511 511 MSTP_NR }; 512 512 513 513 #define MSTP(_parent, _reg, _bit, _flags) \ ··· 543 543 [MSTP314] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */ 544 544 [MSTP313] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */ 545 545 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */ 546 + [MSTP423] = MSTP(&div4_clks[DIV4_B], SMSTPCR4, 23, 0), /* DSITX1 */ 546 547 [MSTP415] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 15, 0), /* SDHI2 */ 547 548 [MSTP413] = MSTP(&pllc1_div2_clk, SMSTPCR4, 13, 0), /* HDMI */ 548 549 [MSTP411] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 11, 0), /* IIC3 */ ··· 597 596 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]), 598 597 CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]), 599 598 CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]), 600 - CLKDEV_CON_ID("dsit_clk", &div6_clks[DIV6_DSIT]), 601 - CLKDEV_CON_ID("dsi0p_clk", &div6_clks[DIV6_DSI0P]), 602 - CLKDEV_CON_ID("dsi1p_clk", &div6_clks[DIV6_DSI1P]), 599 + CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), 600 + CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), 601 + CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), 602 + CLKDEV_ICK_ID("dsi1p_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), 603 603 604 604 /* MSTP32 clocks */ 605 605 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */ ··· 612 610 CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2 */ 613 611 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */ 614 612 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */ 615 - CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ 613 + CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX0 */ 616 614 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */ 617 615 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */ 618 616 CLKDEV_DEV_ID("uio_pdrv_genirq.5", &mstp_clks[MSTP106]), /* JPU */ ··· 635 633 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ 636 634 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ 637 635 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMC */ 636 + CLKDEV_DEV_ID("sh-mipi-dsi.1", &mstp_clks[MSTP423]), /* DSITX1 */ 638 637 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]), /* SDHI2 */ 639 638 CLKDEV_DEV_ID("sh-mobile-hdmi", &mstp_clks[MSTP413]), /* HDMI */ 640 639 CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* IIC3 */
+28 -8
drivers/video/sh_mipi_dsi.c
··· 13 13 #include <linux/init.h> 14 14 #include <linux/io.h> 15 15 #include <linux/platform_device.h> 16 + #include <linux/pm_runtime.h> 16 17 #include <linux/slab.h> 17 18 #include <linux/string.h> 18 19 #include <linux/types.h> ··· 51 50 void __iomem *linkbase; 52 51 struct clk *dsit_clk; 53 52 struct clk *dsip_clk; 54 - void *next_board_data; 55 - void (*next_display_on)(void *board_data, struct fb_info *info); 56 - void (*next_display_off)(void *board_data); 53 + struct device *dev; 54 + 55 + void *next_board_data; 56 + void (*next_display_on)(void *board_data, struct fb_info *info); 57 + void (*next_display_off)(void *board_data); 57 58 }; 58 59 59 60 static struct sh_mipi *mipi_dsi[MAX_SH_MIPI_DSI]; ··· 127 124 { 128 125 struct sh_mipi *mipi = arg; 129 126 127 + pm_runtime_get_sync(mipi->dev); 130 128 sh_mipi_dsi_enable(mipi, true); 131 129 132 130 if (mipi->next_display_on) ··· 142 138 mipi->next_display_off(mipi->next_board_data); 143 139 144 140 sh_mipi_dsi_enable(mipi, false); 141 + pm_runtime_put(mipi->dev); 145 142 } 146 143 147 144 static int __init sh_mipi_setup(struct sh_mipi *mipi, ··· 150 145 { 151 146 void __iomem *base = mipi->base; 152 147 struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan; 153 - u32 pctype, datatype, pixfmt; 154 - u32 linelength; 148 + u32 pctype, datatype, pixfmt, linelength, vmctr2 = 0x00e00000; 155 149 bool yuv; 156 150 157 151 /* ··· 307 303 */ 308 304 iowrite32(0x00000006, mipi->linkbase + DTCTR); 309 305 /* VSYNC width = 2 (<< 17) */ 310 - iowrite32(0x00040000 | (pctype << 12) | datatype, 306 + iowrite32((ch->lcd_cfg[0].vsync_len << pdata->vsynw_offset) | 307 + (pdata->clksrc << 16) | (pctype << 12) | datatype, 311 308 mipi->linkbase + VMCTR1); 309 + 312 310 /* 313 311 * Non-burst mode with sync pulses: VSE and HSE are output, 314 312 * HSA period allowed, no commands in LP 315 313 */ 316 - iowrite32(0x00e00000, mipi->linkbase + VMCTR2); 314 + if (pdata->flags & SH_MIPI_DSI_HSABM) 315 + vmctr2 |= 0x20; 316 + if (pdata->flags & SH_MIPI_DSI_HSPBM) 317 + vmctr2 |= 0x10; 318 + iowrite32(vmctr2, mipi->linkbase + VMCTR2); 319 + 317 320 /* 318 321 * 0x660 = 1632 bytes per line (RGB24, 544 pixels: see 319 322 * sh_mobile_lcdc_info.ch[0].lcd_cfg[0].xres), HSALEN = 1 - default 320 - * (unused, since VMCTR2[HSABM] = 0) 323 + * (unused if VMCTR2[HSABM] = 0) 321 324 */ 322 325 iowrite32(1 | (linelength << 16), mipi->linkbase + VMLEN1); 323 326 ··· 407 396 goto emap2; 408 397 } 409 398 399 + mipi->dev = &pdev->dev; 400 + 410 401 mipi->dsit_clk = clk_get(&pdev->dev, "dsit_clk"); 411 402 if (IS_ERR(mipi->dsit_clk)) { 412 403 ret = PTR_ERR(mipi->dsit_clk); ··· 458 445 459 446 mipi_dsi[idx] = mipi; 460 447 448 + pm_runtime_enable(&pdev->dev); 449 + pm_runtime_resume(&pdev->dev); 450 + 461 451 ret = sh_mipi_setup(mipi, pdata); 462 452 if (ret < 0) 463 453 goto emipisetup; ··· 477 461 pdata->lcd_chan->board_cfg.board_data = mipi; 478 462 pdata->lcd_chan->board_cfg.display_on = mipi_display_on; 479 463 pdata->lcd_chan->board_cfg.display_off = mipi_display_off; 464 + pdata->lcd_chan->board_cfg.owner = THIS_MODULE; 480 465 481 466 return 0; 482 467 483 468 emipisetup: 484 469 mipi_dsi[idx] = NULL; 470 + pm_runtime_disable(&pdev->dev); 485 471 clk_disable(mipi->dsip_clk); 486 472 eclkpon: 487 473 clk_disable(mipi->dsit_clk); ··· 535 517 if (ret < 0) 536 518 return ret; 537 519 520 + pdata->lcd_chan->board_cfg.owner = NULL; 538 521 pdata->lcd_chan->board_cfg.display_on = NULL; 539 522 pdata->lcd_chan->board_cfg.display_off = NULL; 540 523 pdata->lcd_chan->board_cfg.board_data = NULL; 541 524 525 + pm_runtime_disable(&pdev->dev); 542 526 clk_disable(mipi->dsip_clk); 543 527 clk_disable(mipi->dsit_clk); 544 528 clk_put(mipi->dsit_clk);
+6
include/video/sh_mipi_dsi.h
··· 27 27 28 28 struct sh_mobile_lcdc_chan_cfg; 29 29 30 + #define SH_MIPI_DSI_HSABM (1 << 0) 31 + #define SH_MIPI_DSI_HSPBM (1 << 1) 32 + 30 33 struct sh_mipi_dsi_info { 31 34 enum sh_mipi_dsi_data_fmt data_format; 32 35 struct sh_mobile_lcdc_chan_cfg *lcd_chan; 36 + unsigned long flags; 37 + u32 clksrc; 38 + unsigned int vsynw_offset; 33 39 }; 34 40 35 41 #endif