Lines Matching refs:fsl_ldb

86 struct fsl_ldb {  struct
97 static bool fsl_ldb_is_dual(const struct fsl_ldb *fsl_ldb) in fsl_ldb_is_dual() argument
99 return (fsl_ldb->ch0_enabled && fsl_ldb->ch1_enabled); in fsl_ldb_is_dual()
102 static inline struct fsl_ldb *to_fsl_ldb(struct drm_bridge *bridge) in to_fsl_ldb()
104 return container_of(bridge, struct fsl_ldb, bridge); in to_fsl_ldb()
107 static unsigned long fsl_ldb_link_frequency(struct fsl_ldb *fsl_ldb, int clock) in fsl_ldb_link_frequency() argument
109 if (fsl_ldb_is_dual(fsl_ldb)) in fsl_ldb_link_frequency()
118 struct fsl_ldb *fsl_ldb = to_fsl_ldb(bridge); in fsl_ldb_attach() local
120 return drm_bridge_attach(bridge->encoder, fsl_ldb->panel_bridge, in fsl_ldb_attach()
127 struct fsl_ldb *fsl_ldb = to_fsl_ldb(bridge); in fsl_ldb_atomic_enable() local
163 dev_warn(fsl_ldb->dev, in fsl_ldb_atomic_enable()
179 requested_link_freq = fsl_ldb_link_frequency(fsl_ldb, mode->clock); in fsl_ldb_atomic_enable()
180 clk_set_rate(fsl_ldb->clk, requested_link_freq); in fsl_ldb_atomic_enable()
182 configured_link_freq = clk_get_rate(fsl_ldb->clk); in fsl_ldb_atomic_enable()
184 …dev_warn(fsl_ldb->dev, "Configured LDB clock (%lu Hz) does not match requested LVDS clock: %lu Hz\… in fsl_ldb_atomic_enable()
188 clk_prepare_enable(fsl_ldb->clk); in fsl_ldb_atomic_enable()
191 reg = (fsl_ldb->ch0_enabled ? LDB_CTRL_CH0_ENABLE : 0) | in fsl_ldb_atomic_enable()
192 (fsl_ldb->ch1_enabled ? LDB_CTRL_CH1_ENABLE : 0) | in fsl_ldb_atomic_enable()
193 (fsl_ldb_is_dual(fsl_ldb) ? LDB_CTRL_SPLIT_MODE : 0); in fsl_ldb_atomic_enable()
196 reg |= (fsl_ldb->ch0_enabled ? LDB_CTRL_CH0_DATA_WIDTH : 0) | in fsl_ldb_atomic_enable()
197 (fsl_ldb->ch1_enabled ? LDB_CTRL_CH1_DATA_WIDTH : 0); in fsl_ldb_atomic_enable()
200 reg |= (fsl_ldb->ch0_enabled ? LDB_CTRL_CH0_BIT_MAPPING : 0) | in fsl_ldb_atomic_enable()
201 (fsl_ldb->ch1_enabled ? LDB_CTRL_CH1_BIT_MAPPING : 0); in fsl_ldb_atomic_enable()
204 reg |= (fsl_ldb->ch0_enabled ? LDB_CTRL_DI0_VSYNC_POLARITY : 0) | in fsl_ldb_atomic_enable()
205 (fsl_ldb->ch1_enabled ? LDB_CTRL_DI1_VSYNC_POLARITY : 0); in fsl_ldb_atomic_enable()
207 regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->ldb_ctrl, reg); in fsl_ldb_atomic_enable()
209 if (fsl_ldb->devdata->single_ctrl_reg) in fsl_ldb_atomic_enable()
215 regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, reg); in fsl_ldb_atomic_enable()
220 reg |= (fsl_ldb->ch0_enabled ? LVDS_CTRL_CH0_EN : 0) | in fsl_ldb_atomic_enable()
221 (fsl_ldb->ch1_enabled ? LVDS_CTRL_CH1_EN : 0); in fsl_ldb_atomic_enable()
223 regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, reg); in fsl_ldb_atomic_enable()
229 struct fsl_ldb *fsl_ldb = to_fsl_ldb(bridge); in fsl_ldb_atomic_disable() local
232 if (fsl_ldb->devdata->lvds_en_bit) in fsl_ldb_atomic_disable()
234 regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, in fsl_ldb_atomic_disable()
237 if (!fsl_ldb->devdata->single_ctrl_reg) in fsl_ldb_atomic_disable()
238 regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, 0); in fsl_ldb_atomic_disable()
239 regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->ldb_ctrl, 0); in fsl_ldb_atomic_disable()
241 clk_disable_unprepare(fsl_ldb->clk); in fsl_ldb_atomic_disable()
273 struct fsl_ldb *fsl_ldb = to_fsl_ldb(bridge); in fsl_ldb_mode_valid() local
275 if (mode->clock > (fsl_ldb_is_dual(fsl_ldb) ? 160000 : 80000)) in fsl_ldb_mode_valid()
298 struct fsl_ldb *fsl_ldb; in fsl_ldb_probe() local
301 fsl_ldb = devm_kzalloc(dev, sizeof(*fsl_ldb), GFP_KERNEL); in fsl_ldb_probe()
302 if (!fsl_ldb) in fsl_ldb_probe()
305 fsl_ldb->devdata = of_device_get_match_data(dev); in fsl_ldb_probe()
306 if (!fsl_ldb->devdata) in fsl_ldb_probe()
309 fsl_ldb->dev = &pdev->dev; in fsl_ldb_probe()
310 fsl_ldb->bridge.funcs = &funcs; in fsl_ldb_probe()
311 fsl_ldb->bridge.of_node = dev->of_node; in fsl_ldb_probe()
313 fsl_ldb->clk = devm_clk_get(dev, "ldb"); in fsl_ldb_probe()
314 if (IS_ERR(fsl_ldb->clk)) in fsl_ldb_probe()
315 return PTR_ERR(fsl_ldb->clk); in fsl_ldb_probe()
317 fsl_ldb->regmap = syscon_node_to_regmap(dev->of_node->parent); in fsl_ldb_probe()
318 if (IS_ERR(fsl_ldb->regmap)) in fsl_ldb_probe()
319 return PTR_ERR(fsl_ldb->regmap); in fsl_ldb_probe()
324 fsl_ldb->ch0_enabled = (remote1 != NULL); in fsl_ldb_probe()
325 fsl_ldb->ch1_enabled = (remote2 != NULL); in fsl_ldb_probe()
330 if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled) { in fsl_ldb_probe()
336 fsl_ldb_is_dual(fsl_ldb) ? "dual-link mode" : in fsl_ldb_probe()
337 fsl_ldb->ch0_enabled ? "channel 0" : "channel 1"); in fsl_ldb_probe()
344 fsl_ldb->panel_bridge = devm_drm_panel_bridge_add(dev, panel); in fsl_ldb_probe()
345 if (IS_ERR(fsl_ldb->panel_bridge)) in fsl_ldb_probe()
346 return PTR_ERR(fsl_ldb->panel_bridge); in fsl_ldb_probe()
349 if (fsl_ldb_is_dual(fsl_ldb)) { in fsl_ldb_probe()
369 platform_set_drvdata(pdev, fsl_ldb); in fsl_ldb_probe()
371 drm_bridge_add(&fsl_ldb->bridge); in fsl_ldb_probe()
378 struct fsl_ldb *fsl_ldb = platform_get_drvdata(pdev); in fsl_ldb_remove() local
380 drm_bridge_remove(&fsl_ldb->bridge); in fsl_ldb_remove()