Lines Matching +full:r8a77990 +full:- +full:lvds
1 // SPDX-License-Identifier: GPL-2.0
3 * rcar_lvds.c -- R-Car LVDS Encoder
5 * Copyright (C) 2013-2018 Renesas Electronics Corporation
47 #define RCAR_LVDS_QUIRK_LANES BIT(0) /* LVDS lanes 1 and 3 inverted */
51 #define RCAR_LVDS_QUIRK_DUAL_LINK BIT(4) /* Supports dual-link operation */
56 void (*pll_setup)(struct rcar_lvds *lvds, unsigned int freq);
86 static void rcar_lvds_write(struct rcar_lvds *lvds, u32 reg, u32 data) in rcar_lvds_write() argument
88 iowrite32(data, lvds->mmio + reg); in rcar_lvds_write()
91 /* -----------------------------------------------------------------------------
97 struct rcar_lvds *lvds = connector_to_rcar_lvds(connector); in rcar_lvds_connector_get_modes() local
99 return drm_panel_get_modes(lvds->panel, connector); in rcar_lvds_connector_get_modes()
105 struct rcar_lvds *lvds = connector_to_rcar_lvds(connector); in rcar_lvds_connector_atomic_check() local
111 if (!conn_state->crtc) in rcar_lvds_connector_atomic_check()
114 if (list_empty(&connector->modes)) { in rcar_lvds_connector_atomic_check()
115 dev_dbg(lvds->dev, "connector: empty modes list\n"); in rcar_lvds_connector_atomic_check()
116 return -EINVAL; in rcar_lvds_connector_atomic_check()
119 panel_mode = list_first_entry(&connector->modes, in rcar_lvds_connector_atomic_check()
123 crtc_state = drm_atomic_get_crtc_state(state, conn_state->crtc); in rcar_lvds_connector_atomic_check()
127 if (crtc_state->mode.hdisplay != panel_mode->hdisplay || in rcar_lvds_connector_atomic_check()
128 crtc_state->mode.vdisplay != panel_mode->vdisplay) in rcar_lvds_connector_atomic_check()
129 return -EINVAL; in rcar_lvds_connector_atomic_check()
132 drm_mode_copy(&crtc_state->adjusted_mode, panel_mode); in rcar_lvds_connector_atomic_check()
150 /* -----------------------------------------------------------------------------
154 static void rcar_lvds_pll_setup_gen2(struct rcar_lvds *lvds, unsigned int freq) in rcar_lvds_pll_setup_gen2() argument
167 rcar_lvds_write(lvds, LVDPLLCR, val); in rcar_lvds_pll_setup_gen2()
170 static void rcar_lvds_pll_setup_gen3(struct rcar_lvds *lvds, unsigned int freq) in rcar_lvds_pll_setup_gen3() argument
183 rcar_lvds_write(lvds, LVDPLLCR, val); in rcar_lvds_pll_setup_gen3()
195 static void rcar_lvds_d3_e3_pll_calc(struct rcar_lvds *lvds, struct clk *clk, in rcar_lvds_d3_e3_pll_calc() argument
211 * The LVDS PLL is made of a pre-divider and a multiplier (strangely in rcar_lvds_d3_e3_pll_calc()
212 * enough called M and N respectively), followed by a post-divider E. in rcar_lvds_d3_e3_pll_calc()
214 * ,-----. ,-----. ,-----. ,-----. in rcar_lvds_d3_e3_pll_calc()
215 * Fin --> | 1/M | -Fpdf-> | PFD | --> | VCO | -Fvco-> | 1/E | --> Fout in rcar_lvds_d3_e3_pll_calc()
216 * `-----' ,-> | | `-----' | `-----' in rcar_lvds_d3_e3_pll_calc()
217 * | `-----' | in rcar_lvds_d3_e3_pll_calc()
218 * | ,-----. | in rcar_lvds_d3_e3_pll_calc()
219 * `-------- | 1/N | <-------' in rcar_lvds_d3_e3_pll_calc()
220 * `-----' in rcar_lvds_d3_e3_pll_calc()
225 * clock (as LVDS transmits 7 bits per lane per clock sample). in rcar_lvds_d3_e3_pll_calc()
227 * ,-------. ,-----. |\ in rcar_lvds_d3_e3_pll_calc()
228 * Fout --> | 1/DIV | --> | 1/7 | --> | | in rcar_lvds_d3_e3_pll_calc()
229 * `-------' | `-----' | | --> dot clock in rcar_lvds_d3_e3_pll_calc()
230 * `------------> | | in rcar_lvds_d3_e3_pll_calc()
233 * The /7 divider is optional, it is enabled when the LVDS PLL is used in rcar_lvds_d3_e3_pll_calc()
234 * to drive the LVDS encoder, and disabled when used to generate a dot in rcar_lvds_d3_e3_pll_calc()
235 * clock for the DU RGB output, without using the LVDS encoder. in rcar_lvds_d3_e3_pll_calc()
246 * allowed values for the pre-divider M (normal range 1-8). in rcar_lvds_d3_e3_pll_calc()
262 * 60-120). in rcar_lvds_d3_e3_pll_calc()
278 * post-divider E (normal value 1, 2 or 4). in rcar_lvds_d3_e3_pll_calc()
297 diff = abs(fout / div - target); in rcar_lvds_d3_e3_pll_calc()
299 if (diff < pll->diff) { in rcar_lvds_d3_e3_pll_calc()
300 pll->diff = diff; in rcar_lvds_d3_e3_pll_calc()
301 pll->pll_m = m; in rcar_lvds_d3_e3_pll_calc()
302 pll->pll_n = n; in rcar_lvds_d3_e3_pll_calc()
303 pll->pll_e = e; in rcar_lvds_d3_e3_pll_calc()
304 pll->div = div; in rcar_lvds_d3_e3_pll_calc()
305 pll->clksel = clksel; in rcar_lvds_d3_e3_pll_calc()
315 output = fin * pll->pll_n / pll->pll_m / (1 << pll->pll_e) in rcar_lvds_d3_e3_pll_calc()
316 / div7 / pll->div; in rcar_lvds_d3_e3_pll_calc()
317 error = (long)(output - target) * 10000 / (long)target; in rcar_lvds_d3_e3_pll_calc()
319 dev_dbg(lvds->dev, in rcar_lvds_d3_e3_pll_calc()
320 "%pC %lu Hz -> Fout %lu Hz (target %lu Hz, error %d.%02u%%), PLL M/N/E/DIV %u/%u/%u/%u\n", in rcar_lvds_d3_e3_pll_calc()
322 error < 0 ? -error % 100 : error % 100, in rcar_lvds_d3_e3_pll_calc()
323 pll->pll_m, pll->pll_n, pll->pll_e, pll->div); in rcar_lvds_d3_e3_pll_calc()
326 static void __rcar_lvds_pll_setup_d3_e3(struct rcar_lvds *lvds, in __rcar_lvds_pll_setup_d3_e3() argument
329 struct pll_info pll = { .diff = (unsigned long)-1 }; in __rcar_lvds_pll_setup_d3_e3()
332 rcar_lvds_d3_e3_pll_calc(lvds, lvds->clocks.dotclkin[0], freq, &pll, in __rcar_lvds_pll_setup_d3_e3()
334 rcar_lvds_d3_e3_pll_calc(lvds, lvds->clocks.dotclkin[1], freq, &pll, in __rcar_lvds_pll_setup_d3_e3()
336 rcar_lvds_d3_e3_pll_calc(lvds, lvds->clocks.extal, freq, &pll, in __rcar_lvds_pll_setup_d3_e3()
340 | LVDPLLCR_PLLN(pll.pll_n - 1) | LVDPLLCR_PLLM(pll.pll_m - 1); in __rcar_lvds_pll_setup_d3_e3()
344 | LVDPLLCR_PLLE(pll.pll_e - 1); in __rcar_lvds_pll_setup_d3_e3()
349 rcar_lvds_write(lvds, LVDPLLCR, lvdpllcr); in __rcar_lvds_pll_setup_d3_e3()
356 rcar_lvds_write(lvds, LVDDIV, LVDDIV_DIVSEL | in __rcar_lvds_pll_setup_d3_e3()
357 LVDDIV_DIVRESET | LVDDIV_DIV(pll.div - 1)); in __rcar_lvds_pll_setup_d3_e3()
359 rcar_lvds_write(lvds, LVDDIV, 0); in __rcar_lvds_pll_setup_d3_e3()
362 static void rcar_lvds_pll_setup_d3_e3(struct rcar_lvds *lvds, unsigned int freq) in rcar_lvds_pll_setup_d3_e3() argument
364 __rcar_lvds_pll_setup_d3_e3(lvds, freq, false); in rcar_lvds_pll_setup_d3_e3()
367 /* -----------------------------------------------------------------------------
368 * Clock - D3/E3 only
373 struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); in rcar_lvds_clk_enable() local
376 if (WARN_ON(!(lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL))) in rcar_lvds_clk_enable()
377 return -ENODEV; in rcar_lvds_clk_enable()
379 dev_dbg(lvds->dev, "enabling LVDS PLL, freq=%luHz\n", freq); in rcar_lvds_clk_enable()
381 ret = clk_prepare_enable(lvds->clocks.mod); in rcar_lvds_clk_enable()
385 __rcar_lvds_pll_setup_d3_e3(lvds, freq, true); in rcar_lvds_clk_enable()
393 struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); in rcar_lvds_clk_disable() local
395 if (WARN_ON(!(lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL))) in rcar_lvds_clk_disable()
398 dev_dbg(lvds->dev, "disabling LVDS PLL\n"); in rcar_lvds_clk_disable()
400 rcar_lvds_write(lvds, LVDPLLCR, 0); in rcar_lvds_clk_disable()
402 clk_disable_unprepare(lvds->clocks.mod); in rcar_lvds_clk_disable()
406 /* -----------------------------------------------------------------------------
410 static enum rcar_lvds_mode rcar_lvds_get_lvds_mode(struct rcar_lvds *lvds, in rcar_lvds_get_lvds_mode() argument
417 * There is no API yet to retrieve LVDS mode from a bridge, only panels in rcar_lvds_get_lvds_mode()
420 if (!lvds->panel) in rcar_lvds_get_lvds_mode()
423 info = &connector->display_info; in rcar_lvds_get_lvds_mode()
424 if (!info->num_bus_formats || !info->bus_formats) { in rcar_lvds_get_lvds_mode()
425 dev_warn(lvds->dev, in rcar_lvds_get_lvds_mode()
426 "no LVDS bus format reported, using JEIDA\n"); in rcar_lvds_get_lvds_mode()
430 switch (info->bus_formats[0]) { in rcar_lvds_get_lvds_mode()
439 dev_warn(lvds->dev, in rcar_lvds_get_lvds_mode()
440 "unsupported LVDS bus format 0x%04x, using JEIDA\n", in rcar_lvds_get_lvds_mode()
441 info->bus_formats[0]); in rcar_lvds_get_lvds_mode()
445 if (info->bus_flags & DRM_BUS_FLAG_DATA_LSB_TO_MSB) in rcar_lvds_get_lvds_mode()
456 struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); in __rcar_lvds_atomic_enable() local
461 ret = clk_prepare_enable(lvds->clocks.mod); in __rcar_lvds_atomic_enable()
465 /* Enable the companion LVDS encoder in dual-link mode. */ in __rcar_lvds_atomic_enable()
466 if (lvds->link_type != RCAR_LVDS_SINGLE_LINK && lvds->companion) in __rcar_lvds_atomic_enable()
467 __rcar_lvds_atomic_enable(lvds->companion, state, crtc, in __rcar_lvds_atomic_enable()
473 * HSYNC -> CTRL0 in __rcar_lvds_atomic_enable()
474 * VSYNC -> CTRL1 in __rcar_lvds_atomic_enable()
475 * DISP -> CTRL2 in __rcar_lvds_atomic_enable()
476 * 0 -> CTRL3 in __rcar_lvds_atomic_enable()
478 rcar_lvds_write(lvds, LVDCTRCR, LVDCTRCR_CTR3SEL_ZERO | in __rcar_lvds_atomic_enable()
482 if (lvds->info->quirks & RCAR_LVDS_QUIRK_LANES) in __rcar_lvds_atomic_enable()
489 rcar_lvds_write(lvds, LVDCHCR, lvdhcr); in __rcar_lvds_atomic_enable()
491 if (lvds->info->quirks & RCAR_LVDS_QUIRK_DUAL_LINK) { in __rcar_lvds_atomic_enable()
494 if (lvds->link_type != RCAR_LVDS_SINGLE_LINK) { in __rcar_lvds_atomic_enable()
502 bool swap_pixels = lvds->link_type == in __rcar_lvds_atomic_enable()
507 * an LVDS dual-link connection. in __rcar_lvds_atomic_enable()
513 | (lvds->companion && swap_pixels ? in __rcar_lvds_atomic_enable()
516 rcar_lvds_write(lvds, LVDSTRIPE, lvdstripe); in __rcar_lvds_atomic_enable()
521 * dual-link mode. in __rcar_lvds_atomic_enable()
523 if (lvds->link_type == RCAR_LVDS_SINGLE_LINK || lvds->companion) { in __rcar_lvds_atomic_enable()
527 &crtc_state->adjusted_mode; in __rcar_lvds_atomic_enable()
529 lvds->info->pll_setup(lvds, mode->clock * 1000); in __rcar_lvds_atomic_enable()
532 /* Set the LVDS mode and select the input. */ in __rcar_lvds_atomic_enable()
533 lvdcr0 = rcar_lvds_get_lvds_mode(lvds, connector) << LVDCR0_LVMD_SHIFT; in __rcar_lvds_atomic_enable()
535 if (lvds->bridge.encoder) { in __rcar_lvds_atomic_enable()
540 rcar_lvds_write(lvds, LVDCR0, lvdcr0); in __rcar_lvds_atomic_enable()
543 rcar_lvds_write(lvds, LVDCR1, in __rcar_lvds_atomic_enable()
547 if (lvds->info->gen < 3) { in __rcar_lvds_atomic_enable()
548 /* Enable LVDS operation and turn the bias circuitry on. */ in __rcar_lvds_atomic_enable()
550 rcar_lvds_write(lvds, LVDCR0, lvdcr0); in __rcar_lvds_atomic_enable()
553 if (!(lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL)) { in __rcar_lvds_atomic_enable()
559 rcar_lvds_write(lvds, LVDCR0, lvdcr0); in __rcar_lvds_atomic_enable()
562 if (lvds->info->quirks & RCAR_LVDS_QUIRK_PWD) { in __rcar_lvds_atomic_enable()
563 /* Set LVDS normal mode. */ in __rcar_lvds_atomic_enable()
565 rcar_lvds_write(lvds, LVDCR0, lvdcr0); in __rcar_lvds_atomic_enable()
568 if (lvds->info->quirks & RCAR_LVDS_QUIRK_GEN3_LVEN) { in __rcar_lvds_atomic_enable()
570 * Turn on the LVDS PHY. On D3, the LVEN and LVRES bit must be in __rcar_lvds_atomic_enable()
574 if (!(lvds->info->quirks & RCAR_LVDS_QUIRK_PWD)) in __rcar_lvds_atomic_enable()
575 rcar_lvds_write(lvds, LVDCR0, lvdcr0); in __rcar_lvds_atomic_enable()
578 if (!(lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL)) { in __rcar_lvds_atomic_enable()
585 rcar_lvds_write(lvds, LVDCR0, lvdcr0); in __rcar_lvds_atomic_enable()
587 if (lvds->panel) { in __rcar_lvds_atomic_enable()
588 drm_panel_prepare(lvds->panel); in __rcar_lvds_atomic_enable()
589 drm_panel_enable(lvds->panel); in __rcar_lvds_atomic_enable()
596 struct drm_atomic_state *state = old_bridge_state->base.state; in rcar_lvds_atomic_enable()
601 bridge->encoder); in rcar_lvds_atomic_enable()
602 crtc = drm_atomic_get_new_connector_state(state, connector)->crtc; in rcar_lvds_atomic_enable()
610 struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); in rcar_lvds_atomic_disable() local
612 if (lvds->panel) { in rcar_lvds_atomic_disable()
613 drm_panel_disable(lvds->panel); in rcar_lvds_atomic_disable()
614 drm_panel_unprepare(lvds->panel); in rcar_lvds_atomic_disable()
617 rcar_lvds_write(lvds, LVDCR0, 0); in rcar_lvds_atomic_disable()
618 rcar_lvds_write(lvds, LVDCR1, 0); in rcar_lvds_atomic_disable()
619 rcar_lvds_write(lvds, LVDPLLCR, 0); in rcar_lvds_atomic_disable()
621 /* Disable the companion LVDS encoder in dual-link mode. */ in rcar_lvds_atomic_disable()
622 if (lvds->link_type != RCAR_LVDS_SINGLE_LINK && lvds->companion) in rcar_lvds_atomic_disable()
623 lvds->companion->funcs->atomic_disable(lvds->companion, in rcar_lvds_atomic_disable()
626 clk_disable_unprepare(lvds->clocks.mod); in rcar_lvds_atomic_disable()
633 struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); in rcar_lvds_mode_fixup() local
637 * The internal LVDS encoder has a restricted clock frequency operating in rcar_lvds_mode_fixup()
641 min_freq = lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL ? 5000 : 31000; in rcar_lvds_mode_fixup()
642 adjusted_mode->clock = clamp(adjusted_mode->clock, min_freq, 148500); in rcar_lvds_mode_fixup()
650 struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); in rcar_lvds_attach() local
651 struct drm_connector *connector = &lvds->connector; in rcar_lvds_attach()
652 struct drm_encoder *encoder = bridge->encoder; in rcar_lvds_attach()
656 if (lvds->next_bridge) in rcar_lvds_attach()
657 return drm_bridge_attach(bridge->encoder, lvds->next_bridge, in rcar_lvds_attach()
662 return -EINVAL; in rcar_lvds_attach()
666 if (!lvds->panel) in rcar_lvds_attach()
669 ret = drm_connector_init(bridge->dev, connector, &rcar_lvds_conn_funcs, in rcar_lvds_attach()
700 struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); in rcar_lvds_dual_link() local
702 return lvds->link_type != RCAR_LVDS_SINGLE_LINK; in rcar_lvds_dual_link()
706 /* -----------------------------------------------------------------------------
710 static int rcar_lvds_parse_dt_companion(struct rcar_lvds *lvds) in rcar_lvds_parse_dt_companion() argument
716 struct device *dev = lvds->dev; in rcar_lvds_parse_dt_companion()
720 /* Locate the companion LVDS encoder for dual-link operation, if any. */ in rcar_lvds_parse_dt_companion()
721 companion = of_parse_phandle(dev->of_node, "renesas,companion", 0); in rcar_lvds_parse_dt_companion()
729 match = of_match_device(dev->driver->of_match_table, dev); in rcar_lvds_parse_dt_companion()
730 if (!of_device_is_compatible(companion, match->compatible)) { in rcar_lvds_parse_dt_companion()
731 dev_err(dev, "Companion LVDS encoder is invalid\n"); in rcar_lvds_parse_dt_companion()
732 ret = -ENXIO; in rcar_lvds_parse_dt_companion()
738 * dual-link mode. We do this by looking at the DT port nodes we are in rcar_lvds_parse_dt_companion()
742 port0 = of_graph_get_port_by_id(dev->of_node, 1); in rcar_lvds_parse_dt_companion()
750 lvds->link_type = RCAR_LVDS_DUAL_LINK_ODD_EVEN_PIXELS; in rcar_lvds_parse_dt_companion()
753 lvds->link_type = RCAR_LVDS_DUAL_LINK_EVEN_ODD_PIXELS; in rcar_lvds_parse_dt_companion()
757 * Early dual-link bridge specific implementations populate the in rcar_lvds_parse_dt_companion()
762 if (lvds->next_bridge && lvds->next_bridge->timings && in rcar_lvds_parse_dt_companion()
763 lvds->next_bridge->timings->dual_link) in rcar_lvds_parse_dt_companion()
764 lvds->link_type = RCAR_LVDS_DUAL_LINK_EVEN_ODD_PIXELS; in rcar_lvds_parse_dt_companion()
766 lvds->link_type = RCAR_LVDS_SINGLE_LINK; in rcar_lvds_parse_dt_companion()
769 if (lvds->link_type == RCAR_LVDS_SINGLE_LINK) { in rcar_lvds_parse_dt_companion()
770 dev_dbg(dev, "Single-link configuration detected\n"); in rcar_lvds_parse_dt_companion()
774 lvds->companion = of_drm_find_bridge(companion); in rcar_lvds_parse_dt_companion()
775 if (!lvds->companion) { in rcar_lvds_parse_dt_companion()
776 ret = -EPROBE_DEFER; in rcar_lvds_parse_dt_companion()
781 "Dual-link configuration detected (companion encoder %pOF)\n", in rcar_lvds_parse_dt_companion()
784 if (lvds->link_type == RCAR_LVDS_DUAL_LINK_ODD_EVEN_PIXELS) in rcar_lvds_parse_dt_companion()
796 companion_lvds = bridge_to_rcar_lvds(lvds->companion); in rcar_lvds_parse_dt_companion()
797 companion_lvds->link_type = lvds->link_type; in rcar_lvds_parse_dt_companion()
805 static int rcar_lvds_parse_dt(struct rcar_lvds *lvds) in rcar_lvds_parse_dt() argument
809 ret = drm_of_find_panel_or_bridge(lvds->dev->of_node, 1, 0, in rcar_lvds_parse_dt()
810 &lvds->panel, &lvds->next_bridge); in rcar_lvds_parse_dt()
814 if (lvds->info->quirks & RCAR_LVDS_QUIRK_DUAL_LINK) in rcar_lvds_parse_dt()
815 ret = rcar_lvds_parse_dt_companion(lvds); in rcar_lvds_parse_dt()
819 * On D3/E3 the LVDS encoder provides a clock to the DU, which can be in rcar_lvds_parse_dt()
820 * used for the DPAD output even when the LVDS output is not connected. in rcar_lvds_parse_dt()
824 if (lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL) in rcar_lvds_parse_dt()
825 return ret == -ENODEV ? 0 : ret; in rcar_lvds_parse_dt()
830 static struct clk *rcar_lvds_get_clock(struct rcar_lvds *lvds, const char *name, in rcar_lvds_get_clock() argument
835 clk = devm_clk_get(lvds->dev, name); in rcar_lvds_get_clock()
839 if (PTR_ERR(clk) == -ENOENT && optional) in rcar_lvds_get_clock()
842 if (PTR_ERR(clk) != -EPROBE_DEFER) in rcar_lvds_get_clock()
843 dev_err(lvds->dev, "failed to get %s clock\n", in rcar_lvds_get_clock()
849 static int rcar_lvds_get_clocks(struct rcar_lvds *lvds) in rcar_lvds_get_clocks() argument
851 lvds->clocks.mod = rcar_lvds_get_clock(lvds, NULL, false); in rcar_lvds_get_clocks()
852 if (IS_ERR(lvds->clocks.mod)) in rcar_lvds_get_clocks()
853 return PTR_ERR(lvds->clocks.mod); in rcar_lvds_get_clocks()
856 * LVDS encoders without an extended PLL have no external clock inputs. in rcar_lvds_get_clocks()
858 if (!(lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL)) in rcar_lvds_get_clocks()
861 lvds->clocks.extal = rcar_lvds_get_clock(lvds, "extal", true); in rcar_lvds_get_clocks()
862 if (IS_ERR(lvds->clocks.extal)) in rcar_lvds_get_clocks()
863 return PTR_ERR(lvds->clocks.extal); in rcar_lvds_get_clocks()
865 lvds->clocks.dotclkin[0] = rcar_lvds_get_clock(lvds, "dclkin.0", true); in rcar_lvds_get_clocks()
866 if (IS_ERR(lvds->clocks.dotclkin[0])) in rcar_lvds_get_clocks()
867 return PTR_ERR(lvds->clocks.dotclkin[0]); in rcar_lvds_get_clocks()
869 lvds->clocks.dotclkin[1] = rcar_lvds_get_clock(lvds, "dclkin.1", true); in rcar_lvds_get_clocks()
870 if (IS_ERR(lvds->clocks.dotclkin[1])) in rcar_lvds_get_clocks()
871 return PTR_ERR(lvds->clocks.dotclkin[1]); in rcar_lvds_get_clocks()
874 if (!lvds->clocks.extal && !lvds->clocks.dotclkin[0] && in rcar_lvds_get_clocks()
875 !lvds->clocks.dotclkin[1]) { in rcar_lvds_get_clocks()
876 dev_err(lvds->dev, in rcar_lvds_get_clocks()
878 return -EINVAL; in rcar_lvds_get_clocks()
901 struct rcar_lvds *lvds; in rcar_lvds_probe() local
905 lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL); in rcar_lvds_probe()
906 if (lvds == NULL) in rcar_lvds_probe()
907 return -ENOMEM; in rcar_lvds_probe()
909 platform_set_drvdata(pdev, lvds); in rcar_lvds_probe()
911 lvds->dev = &pdev->dev; in rcar_lvds_probe()
912 lvds->info = of_device_get_match_data(&pdev->dev); in rcar_lvds_probe()
916 lvds->info = attr->data; in rcar_lvds_probe()
918 ret = rcar_lvds_parse_dt(lvds); in rcar_lvds_probe()
922 lvds->bridge.driver_private = lvds; in rcar_lvds_probe()
923 lvds->bridge.funcs = &rcar_lvds_bridge_ops; in rcar_lvds_probe()
924 lvds->bridge.of_node = pdev->dev.of_node; in rcar_lvds_probe()
927 lvds->mmio = devm_ioremap_resource(&pdev->dev, mem); in rcar_lvds_probe()
928 if (IS_ERR(lvds->mmio)) in rcar_lvds_probe()
929 return PTR_ERR(lvds->mmio); in rcar_lvds_probe()
931 ret = rcar_lvds_get_clocks(lvds); in rcar_lvds_probe()
935 drm_bridge_add(&lvds->bridge); in rcar_lvds_probe()
942 struct rcar_lvds *lvds = platform_get_drvdata(pdev); in rcar_lvds_remove() local
944 drm_bridge_remove(&lvds->bridge); in rcar_lvds_remove()
981 { .compatible = "renesas,r8a7742-lvds", .data = &rcar_lvds_gen2_info },
982 { .compatible = "renesas,r8a7743-lvds", .data = &rcar_lvds_gen2_info },
983 { .compatible = "renesas,r8a7744-lvds", .data = &rcar_lvds_gen2_info },
984 { .compatible = "renesas,r8a774a1-lvds", .data = &rcar_lvds_gen3_info },
985 { .compatible = "renesas,r8a774b1-lvds", .data = &rcar_lvds_gen3_info },
986 { .compatible = "renesas,r8a774c0-lvds", .data = &rcar_lvds_r8a77990_info },
987 { .compatible = "renesas,r8a774e1-lvds", .data = &rcar_lvds_gen3_info },
988 { .compatible = "renesas,r8a7790-lvds", .data = &rcar_lvds_gen2_info },
989 { .compatible = "renesas,r8a7791-lvds", .data = &rcar_lvds_gen2_info },
990 { .compatible = "renesas,r8a7793-lvds", .data = &rcar_lvds_gen2_info },
991 { .compatible = "renesas,r8a7795-lvds", .data = &rcar_lvds_gen3_info },
992 { .compatible = "renesas,r8a7796-lvds", .data = &rcar_lvds_gen3_info },
993 { .compatible = "renesas,r8a77965-lvds", .data = &rcar_lvds_gen3_info },
994 { .compatible = "renesas,r8a77970-lvds", .data = &rcar_lvds_r8a77970_info },
995 { .compatible = "renesas,r8a77980-lvds", .data = &rcar_lvds_gen3_info },
996 { .compatible = "renesas,r8a77990-lvds", .data = &rcar_lvds_r8a77990_info },
997 { .compatible = "renesas,r8a77995-lvds", .data = &rcar_lvds_r8a77995_info },
1007 .name = "rcar-lvds",
1015 MODULE_DESCRIPTION("Renesas R-Car LVDS Encoder Driver");