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

OMAPDSS: HDMI: use common DSS PLL support

Now that we have the common DSS PLL support, change HDMI to use it. This
results in quite a lot of changes, but almost all of them are trivial
name changes.

The function to program the PLL settings can be removed from hdmi_pll.c,
as the common PLL API contains the same functionality.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

+146 -214
+5 -19
drivers/video/fbdev/omap2/dss/hdmi.h
··· 184 184 enum hdmi_core_hdmi_dvi hdmi_dvi_mode; 185 185 }; 186 186 187 - /* HDMI PLL structure */ 188 - struct hdmi_pll_info { 189 - u16 regn; 190 - u16 regm; 191 - u32 regmf; 192 - u16 regm2; 193 - u16 regsd; 194 - 195 - unsigned long clkdco; 196 - unsigned long clkout; 197 - }; 198 - 199 187 struct hdmi_audio_format { 200 188 enum hdmi_stereo_channels stereo_channels; 201 189 u8 active_chnnls_msk; ··· 234 246 }; 235 247 236 248 struct hdmi_pll_data { 249 + struct dss_pll pll; 250 + 237 251 void __iomem *base; 238 252 239 253 struct hdmi_wp_data *wp; 240 - 241 - struct hdmi_pll_info info; 242 254 }; 243 255 244 256 struct hdmi_phy_data { ··· 302 314 int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp); 303 315 304 316 /* HDMI PLL funcs */ 305 - int hdmi_pll_enable(struct hdmi_pll_data *pll); 306 - void hdmi_pll_disable(struct hdmi_pll_data *pll); 307 - int hdmi_pll_set_config(struct hdmi_pll_data *pll); 308 317 void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s); 309 - void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin, 310 - unsigned long target_tmds); 318 + void hdmi_pll_compute(struct hdmi_pll_data *pll, 319 + unsigned long target_tmds, struct dss_pll_clock_info *pi); 311 320 int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll, 312 321 struct hdmi_wp_data *wp); 322 + void hdmi_pll_uninit(struct hdmi_pll_data *hpll); 313 323 314 324 /* HDMI PHY funcs */ 315 325 int hdmi_phy_configure(struct hdmi_phy_data *phy, unsigned long hfbitclk,
+18 -37
drivers/video/fbdev/omap2/dss/hdmi4.c
··· 49 49 50 50 struct hdmi_config cfg; 51 51 52 - struct clk *sys_clk; 53 52 struct regulator *vdda_hdmi_dac_reg; 54 53 55 54 bool core_enabled; ··· 180 181 struct omap_video_timings *p; 181 182 struct omap_overlay_manager *mgr = hdmi.output.manager; 182 183 struct hdmi_wp_data *wp = &hdmi.wp; 184 + struct dss_pll_clock_info hdmi_cinfo = { 0 }; 183 185 184 186 r = hdmi_power_on_core(dssdev); 185 187 if (r) ··· 194 194 195 195 DSSDBG("hdmi_power_on x_res= %d y_res = %d\n", p->x_res, p->y_res); 196 196 197 - hdmi_pll_compute(&hdmi.pll, clk_get_rate(hdmi.sys_clk), p->pixelclock); 197 + hdmi_pll_compute(&hdmi.pll, p->pixelclock, &hdmi_cinfo); 198 198 199 - r = hdmi_pll_enable(&hdmi.pll); 199 + r = dss_pll_enable(&hdmi.pll.pll); 200 200 if (r) { 201 201 DSSERR("Failed to enable PLL\n"); 202 202 goto err_pll_enable; 203 203 } 204 204 205 - r = hdmi_pll_set_config(&hdmi.pll); 205 + r = dss_pll_set_config(&hdmi.pll.pll, &hdmi_cinfo); 206 206 if (r) { 207 207 DSSERR("Failed to configure PLL\n"); 208 208 goto err_pll_cfg; 209 209 } 210 210 211 - r = hdmi_phy_configure(&hdmi.phy, hdmi.pll.info.clkdco, 212 - hdmi.pll.info.clkout); 211 + r = hdmi_phy_configure(&hdmi.phy, hdmi_cinfo.clkdco, 212 + hdmi_cinfo.clkout[0]); 213 213 if (r) { 214 214 DSSDBG("Failed to configure PHY\n"); 215 215 goto err_phy_cfg; ··· 247 247 hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF); 248 248 err_phy_pwr: 249 249 err_pll_cfg: 250 - hdmi_pll_disable(&hdmi.pll); 250 + dss_pll_disable(&hdmi.pll.pll); 251 251 err_pll_enable: 252 252 hdmi_power_off_core(dssdev); 253 253 return -EIO; ··· 265 265 266 266 hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF); 267 267 268 - hdmi_pll_disable(&hdmi.pll); 268 + dss_pll_disable(&hdmi.pll.pll); 269 269 270 270 hdmi_power_off_core(dssdev); 271 271 } ··· 405 405 hdmi_power_off_core(dssdev); 406 406 407 407 mutex_unlock(&hdmi.lock); 408 - } 409 - 410 - static int hdmi_get_clocks(struct platform_device *pdev) 411 - { 412 - struct clk *clk; 413 - 414 - clk = devm_clk_get(&pdev->dev, "sys_clk"); 415 - if (IS_ERR(clk)) { 416 - DSSERR("can't get sys_clk\n"); 417 - return PTR_ERR(clk); 418 - } 419 - 420 - hdmi.sys_clk = clk; 421 - 422 - return 0; 423 408 } 424 409 425 410 static int hdmi_connect(struct omap_dss_device *dssdev, ··· 685 700 686 701 r = hdmi_phy_init(pdev, &hdmi.phy); 687 702 if (r) 688 - return r; 703 + goto err; 689 704 690 705 r = hdmi4_core_init(pdev, &hdmi.core); 691 706 if (r) 692 - return r; 693 - 694 - r = hdmi_get_clocks(pdev); 695 - if (r) { 696 - DSSERR("can't get clocks\n"); 697 - return r; 698 - } 707 + goto err; 699 708 700 709 irq = platform_get_irq(pdev, 0); 701 710 if (irq < 0) { 702 711 DSSERR("platform_get_irq failed\n"); 703 - return -ENODEV; 712 + r = -ENODEV; 713 + goto err; 704 714 } 705 715 706 716 r = devm_request_threaded_irq(&pdev->dev, irq, ··· 703 723 IRQF_ONESHOT, "OMAP HDMI", &hdmi.wp); 704 724 if (r) { 705 725 DSSERR("HDMI IRQ request failed\n"); 706 - return r; 726 + goto err; 707 727 } 708 728 709 729 pm_runtime_enable(&pdev->dev); ··· 713 733 dss_debugfs_create_file("hdmi", hdmi_dump_regs); 714 734 715 735 return 0; 736 + err: 737 + hdmi_pll_uninit(&hdmi.pll); 738 + return r; 716 739 } 717 740 718 741 static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) 719 742 { 720 743 hdmi_uninit_output(pdev); 744 + 745 + hdmi_pll_uninit(&hdmi.pll); 721 746 722 747 pm_runtime_disable(&pdev->dev); 723 748 ··· 731 746 732 747 static int hdmi_runtime_suspend(struct device *dev) 733 748 { 734 - clk_disable_unprepare(hdmi.sys_clk); 735 - 736 749 dispc_runtime_put(); 737 750 738 751 return 0; ··· 743 760 r = dispc_runtime_get(); 744 761 if (r < 0) 745 762 return r; 746 - 747 - clk_prepare_enable(hdmi.sys_clk); 748 763 749 764 return 0; 750 765 }
+19 -37
drivers/video/fbdev/omap2/dss/hdmi5.c
··· 54 54 55 55 struct hdmi_config cfg; 56 56 57 - struct clk *sys_clk; 58 57 struct regulator *vdda_reg; 58 + struct clk *sys_clk; 59 59 60 60 bool core_enabled; 61 61 ··· 198 198 int r; 199 199 struct omap_video_timings *p; 200 200 struct omap_overlay_manager *mgr = hdmi.output.manager; 201 + struct dss_pll_clock_info hdmi_cinfo = { 0 }; 201 202 202 203 r = hdmi_power_on_core(dssdev); 203 204 if (r) ··· 208 207 209 208 DSSDBG("hdmi_power_on x_res= %d y_res = %d\n", p->x_res, p->y_res); 210 209 211 - hdmi_pll_compute(&hdmi.pll, clk_get_rate(hdmi.sys_clk), p->pixelclock); 210 + hdmi_pll_compute(&hdmi.pll, p->pixelclock, &hdmi_cinfo); 212 211 213 212 /* disable and clear irqs */ 214 213 hdmi_wp_clear_irqenable(&hdmi.wp, 0xffffffff); 215 214 hdmi_wp_set_irqstatus(&hdmi.wp, 216 215 hdmi_wp_get_irqstatus(&hdmi.wp)); 217 216 218 - r = hdmi_pll_enable(&hdmi.pll); 217 + r = dss_pll_enable(&hdmi.pll.pll); 219 218 if (r) { 220 219 DSSERR("Failed to enable PLL\n"); 221 220 goto err_pll_enable; 222 221 } 223 222 224 - r = hdmi_pll_set_config(&hdmi.pll); 223 + r = dss_pll_set_config(&hdmi.pll.pll, &hdmi_cinfo); 225 224 if (r) { 226 225 DSSERR("Failed to configure PLL\n"); 227 226 goto err_pll_cfg; 228 227 } 229 228 230 - r = hdmi_phy_configure(&hdmi.phy, hdmi.pll.info.clkdco, 231 - hdmi.pll.info.clkout); 229 + r = hdmi_phy_configure(&hdmi.phy, hdmi_cinfo.clkdco, 230 + hdmi_cinfo.clkout[0]); 232 231 if (r) { 233 232 DSSDBG("Failed to start PHY\n"); 234 233 goto err_phy_cfg; ··· 266 265 err_phy_pwr: 267 266 err_phy_cfg: 268 267 err_pll_cfg: 269 - hdmi_pll_disable(&hdmi.pll); 268 + dss_pll_disable(&hdmi.pll.pll); 270 269 err_pll_enable: 271 270 hdmi_power_off_core(dssdev); 272 271 return -EIO; ··· 284 283 285 284 hdmi_wp_set_phy_pwr(&hdmi.wp, HDMI_PHYPWRCMD_OFF); 286 285 287 - hdmi_pll_disable(&hdmi.pll); 286 + dss_pll_disable(&hdmi.pll.pll); 288 287 289 288 hdmi_power_off_core(dssdev); 290 289 } ··· 435 434 hdmi_power_off_core(dssdev); 436 435 437 436 mutex_unlock(&hdmi.lock); 438 - } 439 - 440 - static int hdmi_get_clocks(struct platform_device *pdev) 441 - { 442 - struct clk *clk; 443 - 444 - clk = devm_clk_get(&pdev->dev, "sys_clk"); 445 - if (IS_ERR(clk)) { 446 - DSSERR("can't get sys_clk\n"); 447 - return PTR_ERR(clk); 448 - } 449 - 450 - hdmi.sys_clk = clk; 451 - 452 - return 0; 453 437 } 454 438 455 439 static int hdmi_connect(struct omap_dss_device *dssdev, ··· 715 729 716 730 r = hdmi_phy_init(pdev, &hdmi.phy); 717 731 if (r) 718 - return r; 732 + goto err; 719 733 720 734 r = hdmi5_core_init(pdev, &hdmi.core); 721 735 if (r) 722 - return r; 723 - 724 - r = hdmi_get_clocks(pdev); 725 - if (r) { 726 - DSSERR("can't get clocks\n"); 727 - return r; 728 - } 736 + goto err; 729 737 730 738 irq = platform_get_irq(pdev, 0); 731 739 if (irq < 0) { 732 740 DSSERR("platform_get_irq failed\n"); 733 - return -ENODEV; 741 + r = -ENODEV; 742 + goto err; 734 743 } 735 744 736 745 r = devm_request_threaded_irq(&pdev->dev, irq, ··· 733 752 IRQF_ONESHOT, "OMAP HDMI", &hdmi.wp); 734 753 if (r) { 735 754 DSSERR("HDMI IRQ request failed\n"); 736 - return r; 755 + goto err; 737 756 } 738 757 739 758 pm_runtime_enable(&pdev->dev); ··· 743 762 dss_debugfs_create_file("hdmi", hdmi_dump_regs); 744 763 745 764 return 0; 765 + err: 766 + hdmi_pll_uninit(&hdmi.pll); 767 + return r; 746 768 } 747 769 748 770 static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) 749 771 { 750 772 hdmi_uninit_output(pdev); 773 + 774 + hdmi_pll_uninit(&hdmi.pll); 751 775 752 776 pm_runtime_disable(&pdev->dev); 753 777 ··· 761 775 762 776 static int hdmi_runtime_suspend(struct device *dev) 763 777 { 764 - clk_disable_unprepare(hdmi.sys_clk); 765 - 766 778 dispc_runtime_put(); 767 779 768 780 return 0; ··· 773 789 r = dispc_runtime_get(); 774 790 if (r < 0) 775 791 return r; 776 - 777 - clk_prepare_enable(hdmi.sys_clk); 778 792 779 793 return 0; 780 794 }
+104 -121
drivers/video/fbdev/omap2/dss/hdmi_pll.c
··· 15 15 #include <linux/err.h> 16 16 #include <linux/io.h> 17 17 #include <linux/platform_device.h> 18 + #include <linux/clk.h> 19 + 18 20 #include <video/omapdss.h> 19 21 20 22 #include "dss.h" 21 23 #include "hdmi.h" 22 - 23 - struct hdmi_pll_features { 24 - bool has_refsel; 25 - bool sys_reset; 26 - unsigned long fint_min, fint_max; 27 - u16 regm_max; 28 - unsigned long dcofreq_low_min, dcofreq_low_max; 29 - unsigned long dcofreq_high_min, dcofreq_high_max; 30 - }; 31 - 32 - static const struct hdmi_pll_features *pll_feat; 33 24 34 25 void hdmi_pll_dump(struct hdmi_pll_data *pll, struct seq_file *s) 35 26 { ··· 38 47 DUMPPLL(PLLCTRL_CFG4); 39 48 } 40 49 41 - void hdmi_pll_compute(struct hdmi_pll_data *pll, unsigned long clkin, 42 - unsigned long target_tmds) 50 + void hdmi_pll_compute(struct hdmi_pll_data *pll, 51 + unsigned long target_tmds, struct dss_pll_clock_info *pi) 43 52 { 44 - struct hdmi_pll_info *pi = &pll->info; 45 53 unsigned long fint, clkdco, clkout; 46 54 unsigned long target_bitclk, target_clkdco; 47 55 unsigned long min_dco; 48 56 unsigned n, m, mf, m2, sd; 57 + unsigned long clkin; 58 + const struct dss_pll_hw *hw = pll->pll.hw; 59 + 60 + clkin = clk_get_rate(pll->pll.clkin); 49 61 50 62 DSSDBG("clkin %lu, target tmds %lu\n", clkin, target_tmds); 51 63 52 64 target_bitclk = target_tmds * 10; 53 65 54 66 /* Fint */ 55 - n = DIV_ROUND_UP(clkin, pll_feat->fint_max); 67 + n = DIV_ROUND_UP(clkin, hw->fint_max); 56 68 fint = clkin / n; 57 69 58 70 /* adjust m2 so that the clkdco will be high enough */ 59 - min_dco = roundup(pll_feat->dcofreq_low_min, fint); 71 + min_dco = roundup(hw->clkdco_min, fint); 60 72 m2 = DIV_ROUND_UP(min_dco, target_bitclk); 61 73 if (m2 == 0) 62 74 m2 = 1; ··· 87 93 n, m, mf, m2, sd); 88 94 DSSDBG("Fint %lu, clkdco %lu, clkout %lu\n", fint, clkdco, clkout); 89 95 90 - pi->regn = n; 91 - pi->regm = m; 92 - pi->regmf = mf; 93 - pi->regm2 = m2; 94 - pi->regsd = sd; 96 + pi->n = n; 97 + pi->m = m; 98 + pi->mf = mf; 99 + pi->mX[0] = m2; 100 + pi->sd = sd; 95 101 102 + pi->fint = fint; 96 103 pi->clkdco = clkdco; 97 - pi->clkout = clkout; 104 + pi->clkout[0] = clkout; 98 105 } 99 106 100 - int hdmi_pll_set_config(struct hdmi_pll_data *pll) 107 + static int hdmi_pll_enable(struct dss_pll *dsspll) 101 108 { 102 - u32 r; 103 - struct hdmi_pll_info *fmt = &pll->info; 104 - 105 - /* PLL start always use manual mode */ 106 - REG_FLD_MOD(pll->base, PLLCTRL_PLL_CONTROL, 0x0, 0, 0); 107 - 108 - r = hdmi_read_reg(pll->base, PLLCTRL_CFG1); 109 - r = FLD_MOD(r, fmt->regm, 20, 9); /* CFG1_PLL_REGM */ 110 - r = FLD_MOD(r, fmt->regn - 1, 8, 1); /* CFG1_PLL_REGN */ 111 - hdmi_write_reg(pll->base, PLLCTRL_CFG1, r); 112 - 113 - r = hdmi_read_reg(pll->base, PLLCTRL_CFG2); 114 - 115 - r = FLD_MOD(r, 0x0, 12, 12); /* PLL_HIGHFREQ divide by 2 */ 116 - r = FLD_MOD(r, 0x1, 13, 13); /* PLL_REFEN */ 117 - r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */ 118 - if (pll_feat->has_refsel) 119 - r = FLD_MOD(r, 0x3, 22, 21); /* REFSEL = SYSCLK */ 120 - 121 - if (fmt->clkdco > pll_feat->dcofreq_low_max) 122 - r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */ 123 - else 124 - r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */ 125 - 126 - hdmi_write_reg(pll->base, PLLCTRL_CFG2, r); 127 - 128 - REG_FLD_MOD(pll->base, PLLCTRL_CFG3, fmt->regsd, 17, 10); 129 - 130 - r = hdmi_read_reg(pll->base, PLLCTRL_CFG4); 131 - r = FLD_MOD(r, fmt->regm2, 24, 18); 132 - r = FLD_MOD(r, fmt->regmf, 17, 0); 133 - hdmi_write_reg(pll->base, PLLCTRL_CFG4, r); 134 - 135 - /* go now */ 136 - REG_FLD_MOD(pll->base, PLLCTRL_PLL_GO, 0x1, 0, 0); 137 - 138 - /* wait for bit change */ 139 - if (hdmi_wait_for_bit_change(pll->base, PLLCTRL_PLL_GO, 140 - 0, 0, 0) != 0) { 141 - DSSERR("PLL GO bit not clearing\n"); 142 - return -ETIMEDOUT; 143 - } 144 - 145 - /* Wait till the lock bit is set in PLL status */ 146 - if (hdmi_wait_for_bit_change(pll->base, 147 - PLLCTRL_PLL_STATUS, 1, 1, 1) != 1) { 148 - DSSERR("cannot lock PLL\n"); 149 - DSSERR("CFG1 0x%x\n", 150 - hdmi_read_reg(pll->base, PLLCTRL_CFG1)); 151 - DSSERR("CFG2 0x%x\n", 152 - hdmi_read_reg(pll->base, PLLCTRL_CFG2)); 153 - DSSERR("CFG4 0x%x\n", 154 - hdmi_read_reg(pll->base, PLLCTRL_CFG4)); 155 - return -ETIMEDOUT; 156 - } 157 - 158 - DSSDBG("PLL locked!\n"); 159 - 160 - return 0; 161 - } 162 - 163 - int hdmi_pll_enable(struct hdmi_pll_data *pll) 164 - { 109 + struct hdmi_pll_data *pll = container_of(dsspll, struct hdmi_pll_data, pll); 165 110 struct hdmi_wp_data *wp = pll->wp; 166 111 u16 r = 0; 167 112 ··· 111 178 return 0; 112 179 } 113 180 114 - void hdmi_pll_disable(struct hdmi_pll_data *pll) 181 + static void hdmi_pll_disable(struct dss_pll *dsspll) 115 182 { 183 + struct hdmi_pll_data *pll = container_of(dsspll, struct hdmi_pll_data, pll); 116 184 struct hdmi_wp_data *wp = pll->wp; 117 185 118 186 hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF); 119 187 } 120 188 121 - static const struct hdmi_pll_features omap44xx_pll_feats = { 122 - .sys_reset = false, 123 - .fint_min = 500000, 124 - .fint_max = 2500000, 125 - .regm_max = 4095, 126 - .dcofreq_low_min = 500000000, 127 - .dcofreq_low_max = 1000000000, 128 - .dcofreq_high_min = 1000000000, 129 - .dcofreq_high_max = 2000000000, 189 + static const struct dss_pll_ops dsi_pll_ops = { 190 + .enable = hdmi_pll_enable, 191 + .disable = hdmi_pll_disable, 192 + .set_config = dss_pll_write_config_type_b, 130 193 }; 131 194 132 - static const struct hdmi_pll_features omap54xx_pll_feats = { 133 - .has_refsel = true, 134 - .sys_reset = true, 135 - .fint_min = 620000, 136 - .fint_max = 2500000, 137 - .regm_max = 2046, 138 - .dcofreq_low_min = 750000000, 139 - .dcofreq_low_max = 1500000000, 140 - .dcofreq_high_min = 1250000000, 141 - .dcofreq_high_max = 2500000000UL, 195 + static const struct dss_pll_hw dss_omap4_hdmi_pll_hw = { 196 + .n_max = 255, 197 + .m_min = 20, 198 + .m_max = 4095, 199 + .mX_max = 127, 200 + .fint_min = 500000, 201 + .fint_max = 2500000, 202 + .clkdco_max = 1800000000, 203 + 204 + .clkdco_min = 500000000, 205 + .clkdco_low = 1000000000, 206 + .clkdco_max = 2000000000, 207 + 208 + .n_msb = 8, 209 + .n_lsb = 1, 210 + .m_msb = 20, 211 + .m_lsb = 9, 212 + 213 + .mX_msb[0] = 24, 214 + .mX_lsb[0] = 18, 215 + 216 + .has_selfreqdco = true, 142 217 }; 143 218 144 - static int hdmi_pll_init_features(struct platform_device *pdev) 219 + static const struct dss_pll_hw dss_omap5_hdmi_pll_hw = { 220 + .n_max = 255, 221 + .m_min = 20, 222 + .m_max = 2045, 223 + .mX_max = 127, 224 + .fint_min = 620000, 225 + .fint_max = 2500000, 226 + .clkdco_max = 1800000000, 227 + 228 + .clkdco_min = 750000000, 229 + .clkdco_low = 1500000000, 230 + .clkdco_max = 2500000000UL, 231 + 232 + .n_msb = 8, 233 + .n_lsb = 1, 234 + .m_msb = 20, 235 + .m_lsb = 9, 236 + 237 + .mX_msb[0] = 24, 238 + .mX_lsb[0] = 18, 239 + 240 + .has_selfreqdco = true, 241 + .has_refsel = true, 242 + }; 243 + 244 + static int dsi_init_pll_data(struct platform_device *pdev, struct hdmi_pll_data *hpll) 145 245 { 146 - struct hdmi_pll_features *dst; 147 - const struct hdmi_pll_features *src; 246 + struct dss_pll *pll = &hpll->pll; 247 + struct clk *clk; 248 + int r; 148 249 149 - dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL); 150 - if (!dst) { 151 - dev_err(&pdev->dev, "Failed to allocate HDMI PHY Features\n"); 152 - return -ENOMEM; 250 + clk = devm_clk_get(&pdev->dev, "sys_clk"); 251 + if (IS_ERR(clk)) { 252 + DSSERR("can't get sys_clk\n"); 253 + return PTR_ERR(clk); 153 254 } 255 + 256 + pll->name = "hdmi"; 257 + pll->base = hpll->base; 258 + pll->clkin = clk; 154 259 155 260 switch (omapdss_get_version()) { 156 261 case OMAPDSS_VER_OMAP4430_ES1: 157 262 case OMAPDSS_VER_OMAP4430_ES2: 158 263 case OMAPDSS_VER_OMAP4: 159 - src = &omap44xx_pll_feats; 264 + pll->hw = &dss_omap4_hdmi_pll_hw; 160 265 break; 161 266 162 267 case OMAPDSS_VER_OMAP5: 163 - src = &omap54xx_pll_feats; 268 + pll->hw = &dss_omap5_hdmi_pll_hw; 164 269 break; 165 270 166 271 default: 167 272 return -ENODEV; 168 273 } 169 274 170 - memcpy(dst, src, sizeof(*dst)); 171 - pll_feat = dst; 275 + pll->ops = &dsi_pll_ops; 276 + 277 + r = dss_pll_register(pll); 278 + if (r) 279 + return r; 172 280 173 281 return 0; 174 282 } ··· 221 247 struct resource *res; 222 248 223 249 pll->wp = wp; 224 - 225 - r = hdmi_pll_init_features(pdev); 226 - if (r) 227 - return r; 228 250 229 251 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll"); 230 252 if (!res) { ··· 234 264 return PTR_ERR(pll->base); 235 265 } 236 266 267 + r = dsi_init_pll_data(pdev, pll); 268 + if (r) { 269 + DSSERR("failed to init HDMI PLL\n"); 270 + return r; 271 + } 272 + 237 273 return 0; 274 + } 275 + 276 + void hdmi_pll_uninit(struct hdmi_pll_data *hpll) 277 + { 278 + struct dss_pll *pll = &hpll->pll; 279 + 280 + dss_pll_unregister(pll); 238 281 }