Lines Matching full:ldb
38 #define DRIVER_NAME "imx-ldb"
66 struct imx_ldb *ldb; member
68 /* Defines what is connected to the ldb, only one at a time */
113 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_ch_set_bus_format() local
114 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_ch_set_bus_format()
121 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24; in imx_ldb_ch_set_bus_format()
123 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24; in imx_ldb_ch_set_bus_format()
127 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24 | in imx_ldb_ch_set_bus_format()
130 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24 | in imx_ldb_ch_set_bus_format()
168 static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno, in imx_ldb_set_clock() argument
173 dev_dbg(ldb->dev, "%s: now: %ld want: %ld\n", __func__, in imx_ldb_set_clock()
174 clk_get_rate(ldb->clk_pll[chno]), serial_clk); in imx_ldb_set_clock()
175 clk_set_rate(ldb->clk_pll[chno], serial_clk); in imx_ldb_set_clock()
177 dev_dbg(ldb->dev, "%s after: %ld\n", __func__, in imx_ldb_set_clock()
178 clk_get_rate(ldb->clk_pll[chno])); in imx_ldb_set_clock()
180 dev_dbg(ldb->dev, "%s: now: %ld want: %ld\n", __func__, in imx_ldb_set_clock()
181 clk_get_rate(ldb->clk[chno]), in imx_ldb_set_clock()
183 clk_set_rate(ldb->clk[chno], di_clk); in imx_ldb_set_clock()
185 dev_dbg(ldb->dev, "%s after: %ld\n", __func__, in imx_ldb_set_clock()
186 clk_get_rate(ldb->clk[chno])); in imx_ldb_set_clock()
188 /* set display clock mux to LDB input clock */ in imx_ldb_set_clock()
189 ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk[chno]); in imx_ldb_set_clock()
191 dev_err(ldb->dev, in imx_ldb_set_clock()
199 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_enable() local
200 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_enable()
203 if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) { in imx_ldb_encoder_enable()
204 dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux); in imx_ldb_encoder_enable()
211 clk_set_parent(ldb->clk_sel[mux], ldb->clk[0]); in imx_ldb_encoder_enable()
212 clk_set_parent(ldb->clk_sel[mux], ldb->clk[1]); in imx_ldb_encoder_enable()
214 clk_prepare_enable(ldb->clk[0]); in imx_ldb_encoder_enable()
215 clk_prepare_enable(ldb->clk[1]); in imx_ldb_encoder_enable()
217 clk_set_parent(ldb->clk_sel[mux], ldb->clk[imx_ldb_ch->chno]); in imx_ldb_encoder_enable()
220 if (imx_ldb_ch == &ldb->channel[0] || dual) { in imx_ldb_encoder_enable()
221 ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; in imx_ldb_encoder_enable()
222 if (mux == 0 || ldb->lvds_mux) in imx_ldb_encoder_enable()
223 ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI0; in imx_ldb_encoder_enable()
225 ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI1; in imx_ldb_encoder_enable()
227 if (imx_ldb_ch == &ldb->channel[1] || dual) { in imx_ldb_encoder_enable()
228 ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; in imx_ldb_encoder_enable()
229 if (mux == 1 || ldb->lvds_mux) in imx_ldb_encoder_enable()
230 ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI1; in imx_ldb_encoder_enable()
232 ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI0; in imx_ldb_encoder_enable()
235 if (ldb->lvds_mux) { in imx_ldb_encoder_enable()
238 if (imx_ldb_ch == &ldb->channel[0]) in imx_ldb_encoder_enable()
239 lvds_mux = &ldb->lvds_mux[0]; in imx_ldb_encoder_enable()
240 else if (imx_ldb_ch == &ldb->channel[1]) in imx_ldb_encoder_enable()
241 lvds_mux = &ldb->lvds_mux[1]; in imx_ldb_encoder_enable()
243 regmap_update_bits(ldb->regmap, lvds_mux->reg, lvds_mux->mask, in imx_ldb_encoder_enable()
247 regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl); in imx_ldb_encoder_enable()
259 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_atomic_mode_set() local
260 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_atomic_mode_set()
266 if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) { in imx_ldb_encoder_atomic_mode_set()
267 dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux); in imx_ldb_encoder_atomic_mode_set()
272 dev_warn(ldb->dev, in imx_ldb_encoder_atomic_mode_set()
276 dev_warn(ldb->dev, in imx_ldb_encoder_atomic_mode_set()
281 dev_warn(ldb->dev, in imx_ldb_encoder_atomic_mode_set()
287 imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk); in imx_ldb_encoder_atomic_mode_set()
288 imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk); in imx_ldb_encoder_atomic_mode_set()
291 imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk, in imx_ldb_encoder_atomic_mode_set()
296 if (imx_ldb_ch == &ldb->channel[0] || dual) { in imx_ldb_encoder_atomic_mode_set()
298 ldb->ldb_ctrl |= LDB_DI0_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
300 ldb->ldb_ctrl &= ~LDB_DI0_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
302 if (imx_ldb_ch == &ldb->channel[1] || dual) { in imx_ldb_encoder_atomic_mode_set()
304 ldb->ldb_ctrl |= LDB_DI1_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
306 ldb->ldb_ctrl &= ~LDB_DI1_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
322 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_disable() local
323 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_disable()
328 if (imx_ldb_ch == &ldb->channel[0] || dual) in imx_ldb_encoder_disable()
329 ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; in imx_ldb_encoder_disable()
330 if (imx_ldb_ch == &ldb->channel[1] || dual) in imx_ldb_encoder_disable()
331 ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; in imx_ldb_encoder_disable()
333 regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl); in imx_ldb_encoder_disable()
336 clk_disable_unprepare(ldb->clk[0]); in imx_ldb_encoder_disable()
337 clk_disable_unprepare(ldb->clk[1]); in imx_ldb_encoder_disable()
340 if (ldb->lvds_mux) { in imx_ldb_encoder_disable()
343 if (imx_ldb_ch == &ldb->channel[0]) in imx_ldb_encoder_disable()
344 lvds_mux = &ldb->lvds_mux[0]; in imx_ldb_encoder_disable()
345 else if (imx_ldb_ch == &ldb->channel[1]) in imx_ldb_encoder_disable()
346 lvds_mux = &ldb->lvds_mux[1]; in imx_ldb_encoder_disable()
348 regmap_read(ldb->regmap, lvds_mux->reg, &mux); in imx_ldb_encoder_disable()
352 mux = (imx_ldb_ch == &ldb->channel[0]) ? 0 : 1; in imx_ldb_encoder_disable()
356 ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk_parent[mux]); in imx_ldb_encoder_disable()
358 dev_err(ldb->dev, in imx_ldb_encoder_disable()
420 static int imx_ldb_get_clk(struct imx_ldb *ldb, int chno) in imx_ldb_get_clk() argument
425 ldb->clk[chno] = devm_clk_get(ldb->dev, clkname); in imx_ldb_get_clk()
426 if (IS_ERR(ldb->clk[chno])) in imx_ldb_get_clk()
427 return PTR_ERR(ldb->clk[chno]); in imx_ldb_get_clk()
430 ldb->clk_pll[chno] = devm_clk_get(ldb->dev, clkname); in imx_ldb_get_clk()
432 return PTR_ERR_OR_ZERO(ldb->clk_pll[chno]); in imx_ldb_get_clk()
438 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_register() local
457 ret = imx_ldb_get_clk(ldb, imx_ldb_ch->chno); in imx_ldb_register()
461 if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) { in imx_ldb_register()
462 ret = imx_ldb_get_clk(ldb, 1); in imx_ldb_register()
477 * historical reasons, the ldb driver can also work without in imx_ldb_register()
540 * For a device declaring compatible = "fsl,imx6q-ldb", "fsl,imx53-ldb",
543 * entries (in this case fsl,imx53-ldb) need to be ordered last.
546 { .compatible = "fsl,imx6q-ldb", .data = imx6q_lvds_mux, },
547 { .compatible = "fsl,imx53-ldb", .data = NULL, },
603 if (!channel->ldb) in imx_ldb_bind()
638 /* disable LDB by resetting the control register to POR default */ in imx_ldb_probe()
690 channel->ldb = imx_ldb; in imx_ldb_probe()