Lines Matching refs:ldb

53 	struct imx_ldb *ldb;  member
102 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_ch_set_bus_format() local
103 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_ch_set_bus_format()
110 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24; in imx_ldb_ch_set_bus_format()
112 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24; in imx_ldb_ch_set_bus_format()
116 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH0_24 | in imx_ldb_ch_set_bus_format()
119 ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24 | in imx_ldb_ch_set_bus_format()
158 static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno, in imx_ldb_set_clock() argument
163 dev_dbg(ldb->dev, "%s: now: %ld want: %ld\n", __func__, in imx_ldb_set_clock()
164 clk_get_rate(ldb->clk_pll[chno]), serial_clk); in imx_ldb_set_clock()
165 clk_set_rate(ldb->clk_pll[chno], serial_clk); in imx_ldb_set_clock()
167 dev_dbg(ldb->dev, "%s after: %ld\n", __func__, in imx_ldb_set_clock()
168 clk_get_rate(ldb->clk_pll[chno])); in imx_ldb_set_clock()
170 dev_dbg(ldb->dev, "%s: now: %ld want: %ld\n", __func__, in imx_ldb_set_clock()
171 clk_get_rate(ldb->clk[chno]), in imx_ldb_set_clock()
173 clk_set_rate(ldb->clk[chno], di_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[chno])); in imx_ldb_set_clock()
179 ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk[chno]); in imx_ldb_set_clock()
181 dev_err(ldb->dev, in imx_ldb_set_clock()
189 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_enable() local
190 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_enable()
196 clk_set_parent(ldb->clk_sel[mux], ldb->clk[0]); in imx_ldb_encoder_enable()
197 clk_set_parent(ldb->clk_sel[mux], ldb->clk[1]); in imx_ldb_encoder_enable()
199 clk_prepare_enable(ldb->clk[0]); in imx_ldb_encoder_enable()
200 clk_prepare_enable(ldb->clk[1]); in imx_ldb_encoder_enable()
202 clk_set_parent(ldb->clk_sel[mux], ldb->clk[imx_ldb_ch->chno]); in imx_ldb_encoder_enable()
205 if (imx_ldb_ch == &ldb->channel[0] || dual) { in imx_ldb_encoder_enable()
206 ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; in imx_ldb_encoder_enable()
207 if (mux == 0 || ldb->lvds_mux) in imx_ldb_encoder_enable()
208 ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI0; in imx_ldb_encoder_enable()
210 ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI1; in imx_ldb_encoder_enable()
212 if (imx_ldb_ch == &ldb->channel[1] || dual) { in imx_ldb_encoder_enable()
213 ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; in imx_ldb_encoder_enable()
214 if (mux == 1 || ldb->lvds_mux) in imx_ldb_encoder_enable()
215 ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI1; in imx_ldb_encoder_enable()
217 ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI0; in imx_ldb_encoder_enable()
220 if (ldb->lvds_mux) { in imx_ldb_encoder_enable()
223 if (imx_ldb_ch == &ldb->channel[0]) in imx_ldb_encoder_enable()
224 lvds_mux = &ldb->lvds_mux[0]; in imx_ldb_encoder_enable()
225 else if (imx_ldb_ch == &ldb->channel[1]) in imx_ldb_encoder_enable()
226 lvds_mux = &ldb->lvds_mux[1]; in imx_ldb_encoder_enable()
228 regmap_update_bits(ldb->regmap, lvds_mux->reg, lvds_mux->mask, in imx_ldb_encoder_enable()
232 regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl); in imx_ldb_encoder_enable()
244 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_atomic_mode_set() local
245 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_atomic_mode_set()
252 dev_warn(ldb->dev, in imx_ldb_encoder_atomic_mode_set()
256 dev_warn(ldb->dev, in imx_ldb_encoder_atomic_mode_set()
262 imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk); in imx_ldb_encoder_atomic_mode_set()
263 imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk); in imx_ldb_encoder_atomic_mode_set()
266 imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk, in imx_ldb_encoder_atomic_mode_set()
271 if (imx_ldb_ch == &ldb->channel[0] || dual) { in imx_ldb_encoder_atomic_mode_set()
273 ldb->ldb_ctrl |= LDB_DI0_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
275 ldb->ldb_ctrl &= ~LDB_DI0_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
277 if (imx_ldb_ch == &ldb->channel[1] || dual) { in imx_ldb_encoder_atomic_mode_set()
279 ldb->ldb_ctrl |= LDB_DI1_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
281 ldb->ldb_ctrl &= ~LDB_DI1_VS_POL_ACT_LOW; in imx_ldb_encoder_atomic_mode_set()
297 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_encoder_disable() local
298 int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; in imx_ldb_encoder_disable()
303 if (imx_ldb_ch == &ldb->channel[0] || dual) in imx_ldb_encoder_disable()
304 ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK; in imx_ldb_encoder_disable()
305 if (imx_ldb_ch == &ldb->channel[1] || dual) in imx_ldb_encoder_disable()
306 ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK; in imx_ldb_encoder_disable()
308 regmap_write(ldb->regmap, IOMUXC_GPR2, ldb->ldb_ctrl); in imx_ldb_encoder_disable()
311 clk_disable_unprepare(ldb->clk[0]); in imx_ldb_encoder_disable()
312 clk_disable_unprepare(ldb->clk[1]); in imx_ldb_encoder_disable()
315 if (ldb->lvds_mux) { in imx_ldb_encoder_disable()
318 if (imx_ldb_ch == &ldb->channel[0]) in imx_ldb_encoder_disable()
319 lvds_mux = &ldb->lvds_mux[0]; in imx_ldb_encoder_disable()
320 else if (imx_ldb_ch == &ldb->channel[1]) in imx_ldb_encoder_disable()
321 lvds_mux = &ldb->lvds_mux[1]; in imx_ldb_encoder_disable()
323 regmap_read(ldb->regmap, lvds_mux->reg, &mux); in imx_ldb_encoder_disable()
327 mux = (imx_ldb_ch == &ldb->channel[0]) ? 0 : 1; in imx_ldb_encoder_disable()
331 ret = clk_set_parent(ldb->clk_sel[mux], ldb->clk_parent[mux]); in imx_ldb_encoder_disable()
333 dev_err(ldb->dev, in imx_ldb_encoder_disable()
395 static int imx_ldb_get_clk(struct imx_ldb *ldb, int chno) in imx_ldb_get_clk() argument
400 ldb->clk[chno] = devm_clk_get(ldb->dev, clkname); in imx_ldb_get_clk()
401 if (IS_ERR(ldb->clk[chno])) in imx_ldb_get_clk()
402 return PTR_ERR(ldb->clk[chno]); in imx_ldb_get_clk()
405 ldb->clk_pll[chno] = devm_clk_get(ldb->dev, clkname); in imx_ldb_get_clk()
407 return PTR_ERR_OR_ZERO(ldb->clk_pll[chno]); in imx_ldb_get_clk()
413 struct imx_ldb *ldb = imx_ldb_ch->ldb; in imx_ldb_register() local
421 ret = imx_ldb_get_clk(ldb, imx_ldb_ch->chno); in imx_ldb_register()
425 if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) { in imx_ldb_register()
426 ret = imx_ldb_get_clk(ldb, 1); in imx_ldb_register()
634 channel->ldb = imx_ldb; in imx_ldb_bind()