• Home
  • Raw
  • Download

Lines Matching refs:ldb

56 	struct imx_ldb *ldb;  member
149 static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno, in imx_ldb_set_clock() argument
154 dev_dbg(ldb->dev, "%s: now: %ld want: %ld\n", __func__, in imx_ldb_set_clock()
155 clk_get_rate(ldb->clk_pll[chno]), serial_clk); in imx_ldb_set_clock()
156 clk_set_rate(ldb->clk_pll[chno], serial_clk); in imx_ldb_set_clock()
158 dev_dbg(ldb->dev, "%s after: %ld\n", __func__, in imx_ldb_set_clock()
159 clk_get_rate(ldb->clk_pll[chno])); in imx_ldb_set_clock()
161 dev_dbg(ldb->dev, "%s: now: %ld want: %ld\n", __func__, in imx_ldb_set_clock()
162 clk_get_rate(ldb->clk[chno]), in imx_ldb_set_clock()
164 clk_set_rate(ldb->clk[chno], di_clk); in imx_ldb_set_clock()
166 dev_dbg(ldb->dev, "%s after: %ld\n", __func__, in imx_ldb_set_clock()
167 clk_get_rate(ldb->clk[chno])); in imx_ldb_set_clock()
170 ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk[chno]); in imx_ldb_set_clock()
172 dev_err(ldb->dev, in imx_ldb_set_clock()
180 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_prepare() local
181 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_prepare()
186 dev_warn(ldb->dev, in imx_ldb_encoder_prepare()
195 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24; in imx_ldb_encoder_prepare()
197 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24; in imx_ldb_encoder_prepare()
202 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24 | in imx_ldb_encoder_prepare()
205 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24 | in imx_ldb_encoder_prepare()
216 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_commit() local
217 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_commit()
220 if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) { in imx_ldb_encoder_commit()
221 dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux); in imx_ldb_encoder_commit()
228 clk_prepare_enable(ldb->clk[0]); in imx_ldb_encoder_commit()
229 clk_prepare_enable(ldb->clk[1]); in imx_ldb_encoder_commit()
232 if (imx_ldb_ch == &ldb->channel[0] || dual) { in imx_ldb_encoder_commit()
233 ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; in imx_ldb_encoder_commit()
234 if (mux == 0 || ldb->lvds_mux) in imx_ldb_encoder_commit()
235 ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI0; in imx_ldb_encoder_commit()
237 ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI1; in imx_ldb_encoder_commit()
239 if (imx_ldb_ch == &ldb->channel[1] || dual) { in imx_ldb_encoder_commit()
240 ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; in imx_ldb_encoder_commit()
241 if (mux == 1 || ldb->lvds_mux) in imx_ldb_encoder_commit()
242 ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI1; in imx_ldb_encoder_commit()
244 ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI0; in imx_ldb_encoder_commit()
247 if (ldb->lvds_mux) { in imx_ldb_encoder_commit()
250 if (imx_ldb_ch == &ldb->channel[0]) in imx_ldb_encoder_commit()
251 lvds_mux = &ldb->lvds_mux[0]; in imx_ldb_encoder_commit()
252 else if (imx_ldb_ch == &ldb->channel[1]) in imx_ldb_encoder_commit()
253 lvds_mux = &ldb->lvds_mux[1]; in imx_ldb_encoder_commit()
255 regmap_update_bits(ldb->regmap, lvds_mux->reg, lvds_mux->mask, in imx_ldb_encoder_commit()
259 regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl); in imx_ldb_encoder_commit()
269 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_mode_set() local
270 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_mode_set()
275 if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) { in imx_ldb_encoder_mode_set()
276 dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux); in imx_ldb_encoder_mode_set()
281 dev_warn(ldb->dev, in imx_ldb_encoder_mode_set()
285 dev_warn(ldb->dev, in imx_ldb_encoder_mode_set()
291 imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk); in imx_ldb_encoder_mode_set()
292 imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk); in imx_ldb_encoder_mode_set()
295 imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk, in imx_ldb_encoder_mode_set()
300 if (imx_ldb_ch == &ldb->channel[0]) { in imx_ldb_encoder_mode_set()
302 ldb->ldb_ctrl |= LDB_DI0_VS_POL_ACT_LOW; in imx_ldb_encoder_mode_set()
304 ldb->ldb_ctrl &= ~LDB_DI0_VS_POL_ACT_LOW; in imx_ldb_encoder_mode_set()
306 if (imx_ldb_ch == &ldb->channel[1]) { in imx_ldb_encoder_mode_set()
308 ldb->ldb_ctrl |= LDB_DI1_VS_POL_ACT_LOW; in imx_ldb_encoder_mode_set()
310 ldb->ldb_ctrl &= ~LDB_DI1_VS_POL_ACT_LOW; in imx_ldb_encoder_mode_set()
317 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_disable() local
318 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_disable()
326 if (imx_ldb_ch == &ldb->channel[0] && in imx_ldb_encoder_disable()
327 (ldb->ldb_ctrl & LDB_CH0_MODE_EN_MASK) == 0) in imx_ldb_encoder_disable()
329 else if (imx_ldb_ch == &ldb->channel[1] && in imx_ldb_encoder_disable()
330 (ldb->ldb_ctrl & LDB_CH1_MODE_EN_MASK) == 0) in imx_ldb_encoder_disable()
335 if (imx_ldb_ch == &ldb->channel[0] || dual) in imx_ldb_encoder_disable()
336 ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; in imx_ldb_encoder_disable()
337 if (imx_ldb_ch == &ldb->channel[1] || dual) in imx_ldb_encoder_disable()
338 ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; in imx_ldb_encoder_disable()
340 regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl); in imx_ldb_encoder_disable()
343 clk_disable_unprepare(ldb->clk[0]); in imx_ldb_encoder_disable()
344 clk_disable_unprepare(ldb->clk[1]); in imx_ldb_encoder_disable()
347 if (ldb->lvds_mux) { in imx_ldb_encoder_disable()
350 if (imx_ldb_ch == &ldb->channel[0]) in imx_ldb_encoder_disable()
351 lvds_mux = &ldb->lvds_mux[0]; in imx_ldb_encoder_disable()
352 else if (imx_ldb_ch == &ldb->channel[1]) in imx_ldb_encoder_disable()
353 lvds_mux = &ldb->lvds_mux[1]; in imx_ldb_encoder_disable()
355 regmap_read(ldb->regmap, lvds_mux->reg, &mux); in imx_ldb_encoder_disable()
359 mux = (imx_ldb_ch == &ldb->channel[0]) ? 0 : 1; in imx_ldb_encoder_disable()
363 ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk_parent[mux]); in imx_ldb_encoder_disable()
365 dev_err(ldb->dev, in imx_ldb_encoder_disable()
397 static int imx_ldb_get_clk(struct imx_ldb *ldb, int chno) in imx_ldb_get_clk() argument
402 ldb->clk[chno] = devm_clk_get(ldb->dev, clkname); in imx_ldb_get_clk()
403 if (IS_ERR(ldb->clk[chno])) in imx_ldb_get_clk()
404 return PTR_ERR(ldb->clk[chno]); in imx_ldb_get_clk()
407 ldb->clk_pll[chno] = devm_clk_get(ldb->dev, clkname); in imx_ldb_get_clk()
409 return PTR_ERR_OR_ZERO(ldb->clk_pll[chno]); in imx_ldb_get_clk()
415 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_register() local
423 ret = imx_ldb_get_clk(ldb, imx_ldb_ch->chno); in imx_ldb_register()
427 if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) { in imx_ldb_register()
428 ret = imx_ldb_get_clk(ldb, 1); in imx_ldb_register()
592 channel->ldb = imx_ldb; in imx_ldb_bind()