Lines Matching refs:ldb

64 	struct imx_ldb *ldb;  member
111 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_ch_set_bus_format() local
112 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_ch_set_bus_format()
119 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24; in imx_ldb_ch_set_bus_format()
121 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24; in imx_ldb_ch_set_bus_format()
125 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24 | in imx_ldb_ch_set_bus_format()
128 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24 | in imx_ldb_ch_set_bus_format()
166 static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno, in imx_ldb_set_clock() argument
171 dev_dbg(ldb->dev, "%s: now: %ld want: %ld\n", __func__, in imx_ldb_set_clock()
172 clk_get_rate(ldb->clk_pll[chno]), serial_clk); in imx_ldb_set_clock()
173 clk_set_rate(ldb->clk_pll[chno], serial_clk); in imx_ldb_set_clock()
175 dev_dbg(ldb->dev, "%s after: %ld\n", __func__, in imx_ldb_set_clock()
176 clk_get_rate(ldb->clk_pll[chno])); in imx_ldb_set_clock()
178 dev_dbg(ldb->dev, "%s: now: %ld want: %ld\n", __func__, in imx_ldb_set_clock()
179 clk_get_rate(ldb->clk[chno]), in imx_ldb_set_clock()
181 clk_set_rate(ldb->clk[chno], di_clk); in imx_ldb_set_clock()
183 dev_dbg(ldb->dev, "%s after: %ld\n", __func__, in imx_ldb_set_clock()
184 clk_get_rate(ldb->clk[chno])); in imx_ldb_set_clock()
187 ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk[chno]); in imx_ldb_set_clock()
189 dev_err(ldb->dev, in imx_ldb_set_clock()
197 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_enable() local
198 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_enable()
201 if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) { in imx_ldb_encoder_enable()
202 dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux); in imx_ldb_encoder_enable()
209 clk_set_parent(ldb->clk_sel[mux], ldb->clk[0]); in imx_ldb_encoder_enable()
210 clk_set_parent(ldb->clk_sel[mux], ldb->clk[1]); in imx_ldb_encoder_enable()
212 clk_prepare_enable(ldb->clk[0]); in imx_ldb_encoder_enable()
213 clk_prepare_enable(ldb->clk[1]); in imx_ldb_encoder_enable()
215 clk_set_parent(ldb->clk_sel[mux], ldb->clk[imx_ldb_ch->chno]); in imx_ldb_encoder_enable()
218 if (imx_ldb_ch == &ldb->channel[0] || dual) { in imx_ldb_encoder_enable()
219 ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; in imx_ldb_encoder_enable()
220 if (mux == 0 || ldb->lvds_mux) in imx_ldb_encoder_enable()
221 ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI0; in imx_ldb_encoder_enable()
223 ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI1; in imx_ldb_encoder_enable()
225 if (imx_ldb_ch == &ldb->channel[1] || dual) { in imx_ldb_encoder_enable()
226 ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; in imx_ldb_encoder_enable()
227 if (mux == 1 || ldb->lvds_mux) in imx_ldb_encoder_enable()
228 ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI1; in imx_ldb_encoder_enable()
230 ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI0; in imx_ldb_encoder_enable()
233 if (ldb->lvds_mux) { in imx_ldb_encoder_enable()
236 if (imx_ldb_ch == &ldb->channel[0]) in imx_ldb_encoder_enable()
237 lvds_mux = &ldb->lvds_mux[0]; in imx_ldb_encoder_enable()
238 else if (imx_ldb_ch == &ldb->channel[1]) in imx_ldb_encoder_enable()
239 lvds_mux = &ldb->lvds_mux[1]; in imx_ldb_encoder_enable()
241 regmap_update_bits(ldb->regmap, lvds_mux->reg, lvds_mux->mask, in imx_ldb_encoder_enable()
245 regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl); in imx_ldb_encoder_enable()
257 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_atomic_mode_set() local
258 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_atomic_mode_set()
264 if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) { in imx_ldb_encoder_atomic_mode_set()
265 dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux); in imx_ldb_encoder_atomic_mode_set()
270 dev_warn(ldb->dev, in imx_ldb_encoder_atomic_mode_set()
274 dev_warn(ldb->dev, in imx_ldb_encoder_atomic_mode_set()
279 dev_warn(ldb->dev, in imx_ldb_encoder_atomic_mode_set()
285 imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk); in imx_ldb_encoder_atomic_mode_set()
286 imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk); in imx_ldb_encoder_atomic_mode_set()
289 imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk, in imx_ldb_encoder_atomic_mode_set()
294 if (imx_ldb_ch == &ldb->channel[0] || dual) { in imx_ldb_encoder_atomic_mode_set()
296 ldb->ldb_ctrl |= LDB_DI0_VS_POL_ACT_LOW; 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 if (imx_ldb_ch == &ldb->channel[1] || dual) { in imx_ldb_encoder_atomic_mode_set()
302 ldb->ldb_ctrl |= LDB_DI1_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
304 ldb->ldb_ctrl &= ~LDB_DI1_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
320 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_disable() local
321 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_disable()
326 if (imx_ldb_ch == &ldb->channel[0] || dual) in imx_ldb_encoder_disable()
327 ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; in imx_ldb_encoder_disable()
328 if (imx_ldb_ch == &ldb->channel[1] || dual) in imx_ldb_encoder_disable()
329 ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; in imx_ldb_encoder_disable()
331 regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl); in imx_ldb_encoder_disable()
334 clk_disable_unprepare(ldb->clk[0]); in imx_ldb_encoder_disable()
335 clk_disable_unprepare(ldb->clk[1]); in imx_ldb_encoder_disable()
338 if (ldb->lvds_mux) { in imx_ldb_encoder_disable()
341 if (imx_ldb_ch == &ldb->channel[0]) in imx_ldb_encoder_disable()
342 lvds_mux = &ldb->lvds_mux[0]; in imx_ldb_encoder_disable()
343 else if (imx_ldb_ch == &ldb->channel[1]) in imx_ldb_encoder_disable()
344 lvds_mux = &ldb->lvds_mux[1]; in imx_ldb_encoder_disable()
346 regmap_read(ldb->regmap, lvds_mux->reg, &mux); in imx_ldb_encoder_disable()
350 mux = (imx_ldb_ch == &ldb->channel[0]) ? 0 : 1; in imx_ldb_encoder_disable()
354 ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk_parent[mux]); in imx_ldb_encoder_disable()
356 dev_err(ldb->dev, in imx_ldb_encoder_disable()
418 static int imx_ldb_get_clk(struct imx_ldb *ldb, int chno) in imx_ldb_get_clk() argument
423 ldb->clk[chno] = devm_clk_get(ldb->dev, clkname); in imx_ldb_get_clk()
424 if (IS_ERR(ldb->clk[chno])) in imx_ldb_get_clk()
425 return PTR_ERR(ldb->clk[chno]); in imx_ldb_get_clk()
428 ldb->clk_pll[chno] = devm_clk_get(ldb->dev, clkname); in imx_ldb_get_clk()
430 return PTR_ERR_OR_ZERO(ldb->clk_pll[chno]); in imx_ldb_get_clk()
436 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_register() local
455 ret = imx_ldb_get_clk(ldb, imx_ldb_ch->chno); in imx_ldb_register()
459 if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) { in imx_ldb_register()
460 ret = imx_ldb_get_clk(ldb, 1); in imx_ldb_register()
601 if (!channel->ldb) in imx_ldb_bind()
691 channel->ldb = imx_ldb; in imx_ldb_probe()