Lines Matching defs:dphy

16 #include <linux/phy/phy-mipi-dphy.h>
76 int (*probe)(struct cdns_dphy *dphy);
77 void (*remove)(struct cdns_dphy *dphy);
78 void (*set_psm_div)(struct cdns_dphy *dphy, u8 div);
79 void (*set_clk_lane_cfg)(struct cdns_dphy *dphy,
81 void (*set_pll_cfg)(struct cdns_dphy *dphy,
83 unsigned long (*get_wakeup_time_ns)(struct cdns_dphy *dphy);
95 static int cdns_dsi_get_dphy_pll_cfg(struct cdns_dphy *dphy,
100 unsigned long pll_ref_hz = clk_get_rate(dphy->pll_ref_clk);
136 static int cdns_dphy_setup_psm(struct cdns_dphy *dphy)
138 unsigned long psm_clk_hz = clk_get_rate(dphy->psm_clk);
145 if (dphy->ops->set_psm_div)
146 dphy->ops->set_psm_div(dphy, psm_div);
151 static void cdns_dphy_set_clk_lane_cfg(struct cdns_dphy *dphy,
154 if (dphy->ops->set_clk_lane_cfg)
155 dphy->ops->set_clk_lane_cfg(dphy, cfg);
158 static void cdns_dphy_set_pll_cfg(struct cdns_dphy *dphy,
161 if (dphy->ops->set_pll_cfg)
162 dphy->ops->set_pll_cfg(dphy, cfg);
165 static unsigned long cdns_dphy_get_wakeup_time_ns(struct cdns_dphy *dphy)
167 return dphy->ops->get_wakeup_time_ns(dphy);
170 static unsigned long cdns_dphy_ref_get_wakeup_time_ns(struct cdns_dphy *dphy)
176 static void cdns_dphy_ref_set_pll_cfg(struct cdns_dphy *dphy,
187 dphy->regs + DPHY_CMN_OPIPDIV);
190 dphy->regs + DPHY_CMN_FBDIV);
193 dphy->regs + DPHY_CMN_PWM);
196 static void cdns_dphy_ref_set_psm_div(struct cdns_dphy *dphy, u8 div)
199 dphy->regs + DPHY_PSM_CFG);
217 struct cdns_dphy *dphy = phy_get_drvdata(phy);
225 ret = cdns_dsi_get_dphy_pll_cfg(dphy, cfg,
230 opts->wakeup = cdns_dphy_get_wakeup_time_ns(dphy) / 1000;
248 struct cdns_dphy *dphy = phy_get_drvdata(phy);
260 ret = cdns_dphy_setup_psm(dphy);
271 cdns_dphy_set_clk_lane_cfg(dphy, DPHY_CLK_CFG_LEFT_DRIVES_LEFT);
277 cdns_dphy_set_pll_cfg(dphy, &cfg);
284 struct cdns_dphy *dphy = phy_get_drvdata(phy);
286 clk_prepare_enable(dphy->psm_clk);
287 clk_prepare_enable(dphy->pll_ref_clk);
291 dphy->regs + DPHY_CMN_SSM);
298 struct cdns_dphy *dphy = phy_get_drvdata(phy);
300 clk_disable_unprepare(dphy->pll_ref_clk);
301 clk_disable_unprepare(dphy->psm_clk);
316 struct cdns_dphy *dphy;
320 dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL);
321 if (!dphy)
323 dev_set_drvdata(&pdev->dev, dphy);
325 dphy->ops = of_device_get_match_data(&pdev->dev);
326 if (!dphy->ops)
330 dphy->regs = devm_ioremap_resource(&pdev->dev, res);
331 if (IS_ERR(dphy->regs))
332 return PTR_ERR(dphy->regs);
334 dphy->psm_clk = devm_clk_get(&pdev->dev, "psm");
335 if (IS_ERR(dphy->psm_clk))
336 return PTR_ERR(dphy->psm_clk);
338 dphy->pll_ref_clk = devm_clk_get(&pdev->dev, "pll_ref");
339 if (IS_ERR(dphy->pll_ref_clk))
340 return PTR_ERR(dphy->pll_ref_clk);
342 if (dphy->ops->probe) {
343 ret = dphy->ops->probe(dphy);
348 dphy->phy = devm_phy_create(&pdev->dev, NULL, &cdns_dphy_ops);
349 if (IS_ERR(dphy->phy)) {
351 if (dphy->ops->remove)
352 dphy->ops->remove(dphy);
353 return PTR_ERR(dphy->phy);
356 phy_set_drvdata(dphy->phy, dphy);
365 struct cdns_dphy *dphy = dev_get_drvdata(&pdev->dev);
367 if (dphy->ops->remove)
368 dphy->ops->remove(dphy);
374 { .compatible = "cdns,dphy", .data = &ref_dphy_ops },
383 .name = "cdns-mipi-dphy",