1 // SPDX-License-Identifier: GPL-2.0
3 * rcar_lvds.c -- R-Car LVDS Encoder
5 * Copyright (C) 2013-2018 Renesas Electronics Corporation
7 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
10 #include <linux/clk.h>
11 #include <linux/delay.h>
14 #include <linux/of_device.h>
15 #include <linux/of_graph.h>
16 #include <linux/platform_device.h>
17 #include <linux/slab.h>
19 #include <drm/drm_atomic.h>
20 #include <drm/drm_atomic_helper.h>
21 #include <drm/drm_bridge.h>
22 #include <drm/drm_crtc_helper.h>
23 #include <drm/drm_panel.h>
25 #include "rcar_lvds_regs.h"
29 /* Keep in sync with the LVDCR0.LVMD hardware register values. */
31 RCAR_LVDS_MODE_JEIDA
= 0,
32 RCAR_LVDS_MODE_MIRROR
= 1,
33 RCAR_LVDS_MODE_VESA
= 4,
36 #define RCAR_LVDS_QUIRK_LANES BIT(0) /* LVDS lanes 1 and 3 inverted */
37 #define RCAR_LVDS_QUIRK_GEN3_LVEN BIT(1) /* LVEN bit needs to be set on R8A77970/R8A7799x */
38 #define RCAR_LVDS_QUIRK_PWD BIT(2) /* PWD bit available (all of Gen3 but E3) */
39 #define RCAR_LVDS_QUIRK_EXT_PLL BIT(3) /* Has extended PLL */
40 #define RCAR_LVDS_QUIRK_DUAL_LINK BIT(4) /* Supports dual-link operation */
42 struct rcar_lvds_device_info
{
45 void (*pll_setup
)(struct rcar_lvds
*lvds
, unsigned int freq
);
50 const struct rcar_lvds_device_info
*info
;
52 struct drm_bridge bridge
;
54 struct drm_bridge
*next_bridge
;
55 struct drm_connector connector
;
56 struct drm_panel
*panel
;
60 struct clk
*mod
; /* CPG module clock */
61 struct clk
*extal
; /* External clock */
62 struct clk
*dotclkin
[2]; /* External DU clocks */
66 struct drm_display_mode display_mode
;
67 enum rcar_lvds_mode mode
;
70 #define bridge_to_rcar_lvds(bridge) \
71 container_of(bridge, struct rcar_lvds, bridge)
73 #define connector_to_rcar_lvds(connector) \
74 container_of(connector, struct rcar_lvds, connector)
76 static void rcar_lvds_write(struct rcar_lvds
*lvds
, u32 reg
, u32 data
)
78 iowrite32(data
, lvds
->mmio
+ reg
);
81 /* -----------------------------------------------------------------------------
85 static int rcar_lvds_connector_get_modes(struct drm_connector
*connector
)
87 struct rcar_lvds
*lvds
= connector_to_rcar_lvds(connector
);
89 return drm_panel_get_modes(lvds
->panel
);
92 static int rcar_lvds_connector_atomic_check(struct drm_connector
*connector
,
93 struct drm_connector_state
*state
)
95 struct rcar_lvds
*lvds
= connector_to_rcar_lvds(connector
);
96 const struct drm_display_mode
*panel_mode
;
97 struct drm_crtc_state
*crtc_state
;
102 if (list_empty(&connector
->modes
)) {
103 dev_dbg(lvds
->dev
, "connector: empty modes list\n");
107 panel_mode
= list_first_entry(&connector
->modes
,
108 struct drm_display_mode
, head
);
110 /* We're not allowed to modify the resolution. */
111 crtc_state
= drm_atomic_get_crtc_state(state
->state
, state
->crtc
);
112 if (IS_ERR(crtc_state
))
113 return PTR_ERR(crtc_state
);
115 if (crtc_state
->mode
.hdisplay
!= panel_mode
->hdisplay
||
116 crtc_state
->mode
.vdisplay
!= panel_mode
->vdisplay
)
119 /* The flat panel mode is fixed, just copy it to the adjusted mode. */
120 drm_mode_copy(&crtc_state
->adjusted_mode
, panel_mode
);
125 static const struct drm_connector_helper_funcs rcar_lvds_conn_helper_funcs
= {
126 .get_modes
= rcar_lvds_connector_get_modes
,
127 .atomic_check
= rcar_lvds_connector_atomic_check
,
130 static const struct drm_connector_funcs rcar_lvds_conn_funcs
= {
131 .reset
= drm_atomic_helper_connector_reset
,
132 .fill_modes
= drm_helper_probe_single_connector_modes
,
133 .destroy
= drm_connector_cleanup
,
134 .atomic_duplicate_state
= drm_atomic_helper_connector_duplicate_state
,
135 .atomic_destroy_state
= drm_atomic_helper_connector_destroy_state
,
138 /* -----------------------------------------------------------------------------
142 static void rcar_lvds_pll_setup_gen2(struct rcar_lvds
*lvds
, unsigned int freq
)
147 val
= LVDPLLCR_CEEN
| LVDPLLCR_COSEL
| LVDPLLCR_PLLDLYCNT_38M
;
148 else if (freq
< 61000000)
149 val
= LVDPLLCR_CEEN
| LVDPLLCR_COSEL
| LVDPLLCR_PLLDLYCNT_60M
;
150 else if (freq
< 121000000)
151 val
= LVDPLLCR_CEEN
| LVDPLLCR_COSEL
| LVDPLLCR_PLLDLYCNT_121M
;
153 val
= LVDPLLCR_PLLDLYCNT_150M
;
155 rcar_lvds_write(lvds
, LVDPLLCR
, val
);
158 static void rcar_lvds_pll_setup_gen3(struct rcar_lvds
*lvds
, unsigned int freq
)
163 val
= LVDPLLCR_PLLDIVCNT_42M
;
164 else if (freq
< 85000000)
165 val
= LVDPLLCR_PLLDIVCNT_85M
;
166 else if (freq
< 128000000)
167 val
= LVDPLLCR_PLLDIVCNT_128M
;
169 val
= LVDPLLCR_PLLDIVCNT_148M
;
171 rcar_lvds_write(lvds
, LVDPLLCR
, val
);
183 static void rcar_lvds_d3_e3_pll_calc(struct rcar_lvds
*lvds
, struct clk
*clk
,
184 unsigned long target
, struct pll_info
*pll
,
187 unsigned long output
;
198 * The LVDS PLL is made of a pre-divider and a multiplier (strangely
199 * enough called M and N respectively), followed by a post-divider E.
201 * ,-----. ,-----. ,-----. ,-----.
202 * Fin --> | 1/M | -Fpdf-> | PFD | --> | VCO | -Fvco-> | 1/E | --> Fout
203 * `-----' ,-> | | `-----' | `-----'
206 * `-------- | 1/N | <-------'
209 * The clock output by the PLL is then further divided by a programmable
210 * divider DIV to achieve the desired target frequency. Finally, an
211 * optional fixed /7 divider is used to convert the bit clock to a pixel
212 * clock (as LVDS transmits 7 bits per lane per clock sample).
214 * ,-------. ,-----. |\
215 * Fout --> | 1/DIV | --> | 1/7 | --> | |
216 * `-------' | `-----' | | --> dot clock
220 * The /7 divider is optional when the LVDS PLL is used to generate a
221 * dot clock for the DU RGB output, without using the LVDS encoder. We
222 * don't support this configuration yet.
224 * The PLL allowed input frequency range is 12 MHz to 192 MHz.
227 fin
= clk_get_rate(clk
);
228 if (fin
< 12000000 || fin
> 192000000)
232 * The comparison frequency range is 12 MHz to 24 MHz, which limits the
233 * allowed values for the pre-divider M (normal range 1-8).
237 m_min
= max_t(unsigned int, 1, DIV_ROUND_UP(fin
, 24000000));
238 m_max
= min_t(unsigned int, 8, fin
/ 12000000);
240 for (m
= m_min
; m
<= m_max
; ++m
) {
247 * The VCO operating range is 900 Mhz to 1800 MHz, which limits
248 * the allowed values for the multiplier N (normal range
254 n_min
= max_t(unsigned int, 60, DIV_ROUND_UP(900000000, fpfd
));
255 n_max
= min_t(unsigned int, 120, 1800000000 / fpfd
);
257 for (n
= n_min
; n
< n_max
; ++n
) {
263 * The output frequency is limited to 1039.5 MHz,
264 * limiting again the allowed values for the
265 * post-divider E (normal value 1, 2 or 4).
270 e_min
= fvco
> 1039500000 ? 1 : 0;
272 for (e
= e_min
; e
< 3; ++e
) {
278 * Finally we have a programable divider after
279 * the PLL, followed by a an optional fixed /7
282 fout
= fvco
/ (1 << e
) / 7;
283 div
= DIV_ROUND_CLOSEST(fout
, target
);
284 diff
= abs(fout
/ div
- target
);
286 if (diff
< pll
->diff
) {
292 pll
->clksel
= clksel
;
302 output
= fin
* pll
->pll_n
/ pll
->pll_m
/ (1 << pll
->pll_e
)
304 error
= (long)(output
- target
) * 10000 / (long)target
;
307 "%pC %lu Hz -> Fout %lu Hz (target %lu Hz, error %d.%02u%%), PLL M/N/E/DIV %u/%u/%u/%u\n",
308 clk
, fin
, output
, target
, error
/ 100,
309 error
< 0 ? -error
% 100 : error
% 100,
310 pll
->pll_m
, pll
->pll_n
, pll
->pll_e
, pll
->div
);
313 static void rcar_lvds_pll_setup_d3_e3(struct rcar_lvds
*lvds
, unsigned int freq
)
315 struct pll_info pll
= { .diff
= (unsigned long)-1 };
318 rcar_lvds_d3_e3_pll_calc(lvds
, lvds
->clocks
.dotclkin
[0], freq
, &pll
,
319 LVDPLLCR_CKSEL_DU_DOTCLKIN(0));
320 rcar_lvds_d3_e3_pll_calc(lvds
, lvds
->clocks
.dotclkin
[1], freq
, &pll
,
321 LVDPLLCR_CKSEL_DU_DOTCLKIN(1));
322 rcar_lvds_d3_e3_pll_calc(lvds
, lvds
->clocks
.extal
, freq
, &pll
,
323 LVDPLLCR_CKSEL_EXTAL
);
325 lvdpllcr
= LVDPLLCR_PLLON
| pll
.clksel
| LVDPLLCR_CLKOUT
326 | LVDPLLCR_PLLN(pll
.pll_n
- 1) | LVDPLLCR_PLLM(pll
.pll_m
- 1);
329 lvdpllcr
|= LVDPLLCR_STP_CLKOUTE
| LVDPLLCR_OUTCLKSEL
330 | LVDPLLCR_PLLE(pll
.pll_e
- 1);
332 rcar_lvds_write(lvds
, LVDPLLCR
, lvdpllcr
);
336 * The DIVRESET bit is a misnomer, setting it to 1 deasserts the
339 rcar_lvds_write(lvds
, LVDDIV
, LVDDIV_DIVSEL
|
340 LVDDIV_DIVRESET
| LVDDIV_DIV(pll
.div
- 1));
342 rcar_lvds_write(lvds
, LVDDIV
, 0);
345 /* -----------------------------------------------------------------------------
349 static void rcar_lvds_enable(struct drm_bridge
*bridge
)
351 struct rcar_lvds
*lvds
= bridge_to_rcar_lvds(bridge
);
352 const struct drm_display_mode
*mode
= &lvds
->display_mode
;
354 * FIXME: We should really retrieve the CRTC through the state, but how
355 * do we get a state pointer?
357 struct drm_crtc
*crtc
= lvds
->bridge
.encoder
->crtc
;
362 WARN_ON(lvds
->enabled
);
364 ret
= clk_prepare_enable(lvds
->clocks
.mod
);
369 * Hardcode the channels and control signals routing for now.
376 rcar_lvds_write(lvds
, LVDCTRCR
, LVDCTRCR_CTR3SEL_ZERO
|
377 LVDCTRCR_CTR2SEL_DISP
| LVDCTRCR_CTR1SEL_VSYNC
|
378 LVDCTRCR_CTR0SEL_HSYNC
);
380 if (lvds
->info
->quirks
& RCAR_LVDS_QUIRK_LANES
)
381 lvdhcr
= LVDCHCR_CHSEL_CH(0, 0) | LVDCHCR_CHSEL_CH(1, 3)
382 | LVDCHCR_CHSEL_CH(2, 2) | LVDCHCR_CHSEL_CH(3, 1);
384 lvdhcr
= LVDCHCR_CHSEL_CH(0, 0) | LVDCHCR_CHSEL_CH(1, 1)
385 | LVDCHCR_CHSEL_CH(2, 2) | LVDCHCR_CHSEL_CH(3, 3);
387 rcar_lvds_write(lvds
, LVDCHCR
, lvdhcr
);
389 if (lvds
->info
->quirks
& RCAR_LVDS_QUIRK_DUAL_LINK
) {
390 /* Disable dual-link mode. */
391 rcar_lvds_write(lvds
, LVDSTRIPE
, 0);
394 /* PLL clock configuration. */
395 lvds
->info
->pll_setup(lvds
, mode
->clock
* 1000);
397 /* Set the LVDS mode and select the input. */
398 lvdcr0
= lvds
->mode
<< LVDCR0_LVMD_SHIFT
;
399 if (drm_crtc_index(crtc
) == 2)
400 lvdcr0
|= LVDCR0_DUSEL
;
401 rcar_lvds_write(lvds
, LVDCR0
, lvdcr0
);
403 /* Turn all the channels on. */
404 rcar_lvds_write(lvds
, LVDCR1
,
405 LVDCR1_CHSTBY(3) | LVDCR1_CHSTBY(2) |
406 LVDCR1_CHSTBY(1) | LVDCR1_CHSTBY(0) | LVDCR1_CLKSTBY
);
408 if (lvds
->info
->gen
< 3) {
409 /* Enable LVDS operation and turn the bias circuitry on. */
410 lvdcr0
|= LVDCR0_BEN
| LVDCR0_LVEN
;
411 rcar_lvds_write(lvds
, LVDCR0
, lvdcr0
);
414 if (!(lvds
->info
->quirks
& RCAR_LVDS_QUIRK_EXT_PLL
)) {
416 * Turn the PLL on (simple PLL only, extended PLL is fully
417 * controlled through LVDPLLCR).
419 lvdcr0
|= LVDCR0_PLLON
;
420 rcar_lvds_write(lvds
, LVDCR0
, lvdcr0
);
423 if (lvds
->info
->quirks
& RCAR_LVDS_QUIRK_PWD
) {
424 /* Set LVDS normal mode. */
425 lvdcr0
|= LVDCR0_PWD
;
426 rcar_lvds_write(lvds
, LVDCR0
, lvdcr0
);
429 if (lvds
->info
->quirks
& RCAR_LVDS_QUIRK_GEN3_LVEN
) {
430 /* Turn on the LVDS PHY. */
431 lvdcr0
|= LVDCR0_LVEN
;
432 rcar_lvds_write(lvds
, LVDCR0
, lvdcr0
);
435 if (!(lvds
->info
->quirks
& RCAR_LVDS_QUIRK_EXT_PLL
)) {
436 /* Wait for the PLL startup delay (simple PLL only). */
437 usleep_range(100, 150);
440 /* Turn the output on. */
441 lvdcr0
|= LVDCR0_LVRES
;
442 rcar_lvds_write(lvds
, LVDCR0
, lvdcr0
);
445 drm_panel_prepare(lvds
->panel
);
446 drm_panel_enable(lvds
->panel
);
449 lvds
->enabled
= true;
452 static void rcar_lvds_disable(struct drm_bridge
*bridge
)
454 struct rcar_lvds
*lvds
= bridge_to_rcar_lvds(bridge
);
456 WARN_ON(!lvds
->enabled
);
459 drm_panel_disable(lvds
->panel
);
460 drm_panel_unprepare(lvds
->panel
);
463 rcar_lvds_write(lvds
, LVDCR0
, 0);
464 rcar_lvds_write(lvds
, LVDCR1
, 0);
465 rcar_lvds_write(lvds
, LVDPLLCR
, 0);
467 clk_disable_unprepare(lvds
->clocks
.mod
);
469 lvds
->enabled
= false;
472 static bool rcar_lvds_mode_fixup(struct drm_bridge
*bridge
,
473 const struct drm_display_mode
*mode
,
474 struct drm_display_mode
*adjusted_mode
)
477 * The internal LVDS encoder has a restricted clock frequency operating
478 * range (31MHz to 148.5MHz). Clamp the clock accordingly.
480 adjusted_mode
->clock
= clamp(adjusted_mode
->clock
, 31000, 148500);
485 static void rcar_lvds_get_lvds_mode(struct rcar_lvds
*lvds
)
487 struct drm_display_info
*info
= &lvds
->connector
.display_info
;
488 enum rcar_lvds_mode mode
;
491 * There is no API yet to retrieve LVDS mode from a bridge, only panels
497 if (!info
->num_bus_formats
|| !info
->bus_formats
) {
498 dev_err(lvds
->dev
, "no LVDS bus format reported\n");
502 switch (info
->bus_formats
[0]) {
503 case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG
:
504 case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA
:
505 mode
= RCAR_LVDS_MODE_JEIDA
;
507 case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG
:
508 mode
= RCAR_LVDS_MODE_VESA
;
511 dev_err(lvds
->dev
, "unsupported LVDS bus format 0x%04x\n",
512 info
->bus_formats
[0]);
516 if (info
->bus_flags
& DRM_BUS_FLAG_DATA_LSB_TO_MSB
)
517 mode
|= RCAR_LVDS_MODE_MIRROR
;
522 static void rcar_lvds_mode_set(struct drm_bridge
*bridge
,
523 struct drm_display_mode
*mode
,
524 struct drm_display_mode
*adjusted_mode
)
526 struct rcar_lvds
*lvds
= bridge_to_rcar_lvds(bridge
);
528 WARN_ON(lvds
->enabled
);
530 lvds
->display_mode
= *adjusted_mode
;
532 rcar_lvds_get_lvds_mode(lvds
);
535 static int rcar_lvds_attach(struct drm_bridge
*bridge
)
537 struct rcar_lvds
*lvds
= bridge_to_rcar_lvds(bridge
);
538 struct drm_connector
*connector
= &lvds
->connector
;
539 struct drm_encoder
*encoder
= bridge
->encoder
;
542 /* If we have a next bridge just attach it. */
543 if (lvds
->next_bridge
)
544 return drm_bridge_attach(bridge
->encoder
, lvds
->next_bridge
,
547 /* Otherwise we have a panel, create a connector. */
548 ret
= drm_connector_init(bridge
->dev
, connector
, &rcar_lvds_conn_funcs
,
549 DRM_MODE_CONNECTOR_LVDS
);
553 drm_connector_helper_add(connector
, &rcar_lvds_conn_helper_funcs
);
555 ret
= drm_connector_attach_encoder(connector
, encoder
);
559 return drm_panel_attach(lvds
->panel
, connector
);
562 static void rcar_lvds_detach(struct drm_bridge
*bridge
)
564 struct rcar_lvds
*lvds
= bridge_to_rcar_lvds(bridge
);
567 drm_panel_detach(lvds
->panel
);
570 static const struct drm_bridge_funcs rcar_lvds_bridge_ops
= {
571 .attach
= rcar_lvds_attach
,
572 .detach
= rcar_lvds_detach
,
573 .enable
= rcar_lvds_enable
,
574 .disable
= rcar_lvds_disable
,
575 .mode_fixup
= rcar_lvds_mode_fixup
,
576 .mode_set
= rcar_lvds_mode_set
,
579 /* -----------------------------------------------------------------------------
583 static int rcar_lvds_parse_dt(struct rcar_lvds
*lvds
)
585 struct device_node
*local_output
= NULL
;
586 struct device_node
*remote_input
= NULL
;
587 struct device_node
*remote
= NULL
;
588 struct device_node
*node
;
589 bool is_bridge
= false;
592 local_output
= of_graph_get_endpoint_by_regs(lvds
->dev
->of_node
, 1, 0);
594 dev_dbg(lvds
->dev
, "unconnected port@1\n");
599 * Locate the connected entity and infer its type from the number of
602 remote
= of_graph_get_remote_port_parent(local_output
);
604 dev_dbg(lvds
->dev
, "unconnected endpoint %pOF\n", local_output
);
609 if (!of_device_is_available(remote
)) {
610 dev_dbg(lvds
->dev
, "connected entity %pOF is disabled\n",
616 remote_input
= of_graph_get_remote_endpoint(local_output
);
618 for_each_endpoint_of_node(remote
, node
) {
619 if (node
!= remote_input
) {
621 * We've found one endpoint other than the input, this
631 lvds
->next_bridge
= of_drm_find_bridge(remote
);
632 if (!lvds
->next_bridge
)
635 lvds
->panel
= of_drm_find_panel(remote
);
636 if (IS_ERR(lvds
->panel
))
637 ret
= PTR_ERR(lvds
->panel
);
641 of_node_put(local_output
);
642 of_node_put(remote_input
);
648 static struct clk
*rcar_lvds_get_clock(struct rcar_lvds
*lvds
, const char *name
,
653 clk
= devm_clk_get(lvds
->dev
, name
);
657 if (PTR_ERR(clk
) == -ENOENT
&& optional
)
660 if (PTR_ERR(clk
) != -EPROBE_DEFER
)
661 dev_err(lvds
->dev
, "failed to get %s clock\n",
662 name
? name
: "module");
667 static int rcar_lvds_get_clocks(struct rcar_lvds
*lvds
)
669 lvds
->clocks
.mod
= rcar_lvds_get_clock(lvds
, NULL
, false);
670 if (IS_ERR(lvds
->clocks
.mod
))
671 return PTR_ERR(lvds
->clocks
.mod
);
674 * LVDS encoders without an extended PLL have no external clock inputs.
676 if (!(lvds
->info
->quirks
& RCAR_LVDS_QUIRK_EXT_PLL
))
679 lvds
->clocks
.extal
= rcar_lvds_get_clock(lvds
, "extal", true);
680 if (IS_ERR(lvds
->clocks
.extal
))
681 return PTR_ERR(lvds
->clocks
.extal
);
683 lvds
->clocks
.dotclkin
[0] = rcar_lvds_get_clock(lvds
, "dclkin.0", true);
684 if (IS_ERR(lvds
->clocks
.dotclkin
[0]))
685 return PTR_ERR(lvds
->clocks
.dotclkin
[0]);
687 lvds
->clocks
.dotclkin
[1] = rcar_lvds_get_clock(lvds
, "dclkin.1", true);
688 if (IS_ERR(lvds
->clocks
.dotclkin
[1]))
689 return PTR_ERR(lvds
->clocks
.dotclkin
[1]);
691 /* At least one input to the PLL must be available. */
692 if (!lvds
->clocks
.extal
&& !lvds
->clocks
.dotclkin
[0] &&
693 !lvds
->clocks
.dotclkin
[1]) {
695 "no input clock (extal, dclkin.0 or dclkin.1)\n");
702 static int rcar_lvds_probe(struct platform_device
*pdev
)
704 struct rcar_lvds
*lvds
;
705 struct resource
*mem
;
708 lvds
= devm_kzalloc(&pdev
->dev
, sizeof(*lvds
), GFP_KERNEL
);
712 platform_set_drvdata(pdev
, lvds
);
714 lvds
->dev
= &pdev
->dev
;
715 lvds
->info
= of_device_get_match_data(&pdev
->dev
);
716 lvds
->enabled
= false;
718 ret
= rcar_lvds_parse_dt(lvds
);
722 lvds
->bridge
.driver_private
= lvds
;
723 lvds
->bridge
.funcs
= &rcar_lvds_bridge_ops
;
724 lvds
->bridge
.of_node
= pdev
->dev
.of_node
;
726 mem
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
727 lvds
->mmio
= devm_ioremap_resource(&pdev
->dev
, mem
);
728 if (IS_ERR(lvds
->mmio
))
729 return PTR_ERR(lvds
->mmio
);
731 ret
= rcar_lvds_get_clocks(lvds
);
735 drm_bridge_add(&lvds
->bridge
);
740 static int rcar_lvds_remove(struct platform_device
*pdev
)
742 struct rcar_lvds
*lvds
= platform_get_drvdata(pdev
);
744 drm_bridge_remove(&lvds
->bridge
);
749 static const struct rcar_lvds_device_info rcar_lvds_gen2_info
= {
751 .pll_setup
= rcar_lvds_pll_setup_gen2
,
754 static const struct rcar_lvds_device_info rcar_lvds_r8a7790_info
= {
756 .quirks
= RCAR_LVDS_QUIRK_LANES
,
757 .pll_setup
= rcar_lvds_pll_setup_gen2
,
760 static const struct rcar_lvds_device_info rcar_lvds_gen3_info
= {
762 .quirks
= RCAR_LVDS_QUIRK_PWD
,
763 .pll_setup
= rcar_lvds_pll_setup_gen3
,
766 static const struct rcar_lvds_device_info rcar_lvds_r8a77970_info
= {
768 .quirks
= RCAR_LVDS_QUIRK_PWD
| RCAR_LVDS_QUIRK_GEN3_LVEN
,
769 .pll_setup
= rcar_lvds_pll_setup_gen2
,
772 static const struct rcar_lvds_device_info rcar_lvds_r8a77990_info
= {
774 .quirks
= RCAR_LVDS_QUIRK_GEN3_LVEN
| RCAR_LVDS_QUIRK_EXT_PLL
775 | RCAR_LVDS_QUIRK_DUAL_LINK
,
776 .pll_setup
= rcar_lvds_pll_setup_d3_e3
,
779 static const struct rcar_lvds_device_info rcar_lvds_r8a77995_info
= {
781 .quirks
= RCAR_LVDS_QUIRK_GEN3_LVEN
| RCAR_LVDS_QUIRK_PWD
782 | RCAR_LVDS_QUIRK_EXT_PLL
| RCAR_LVDS_QUIRK_DUAL_LINK
,
783 .pll_setup
= rcar_lvds_pll_setup_d3_e3
,
786 static const struct of_device_id rcar_lvds_of_table
[] = {
787 { .compatible
= "renesas,r8a7743-lvds", .data
= &rcar_lvds_gen2_info
},
788 { .compatible
= "renesas,r8a7790-lvds", .data
= &rcar_lvds_r8a7790_info
},
789 { .compatible
= "renesas,r8a7791-lvds", .data
= &rcar_lvds_gen2_info
},
790 { .compatible
= "renesas,r8a7793-lvds", .data
= &rcar_lvds_gen2_info
},
791 { .compatible
= "renesas,r8a7795-lvds", .data
= &rcar_lvds_gen3_info
},
792 { .compatible
= "renesas,r8a7796-lvds", .data
= &rcar_lvds_gen3_info
},
793 { .compatible
= "renesas,r8a77970-lvds", .data
= &rcar_lvds_r8a77970_info
},
794 { .compatible
= "renesas,r8a77980-lvds", .data
= &rcar_lvds_gen3_info
},
795 { .compatible
= "renesas,r8a77990-lvds", .data
= &rcar_lvds_r8a77990_info
},
796 { .compatible
= "renesas,r8a77995-lvds", .data
= &rcar_lvds_r8a77995_info
},
800 MODULE_DEVICE_TABLE(of
, rcar_lvds_of_table
);
802 static struct platform_driver rcar_lvds_platform_driver
= {
803 .probe
= rcar_lvds_probe
,
804 .remove
= rcar_lvds_remove
,
807 .of_match_table
= rcar_lvds_of_table
,
811 module_platform_driver(rcar_lvds_platform_driver
);
813 MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>");
814 MODULE_DESCRIPTION("Renesas R-Car LVDS Encoder Driver");
815 MODULE_LICENSE("GPL");