Skip to content

Commit ce2196d

Browse files
tmlindrobertfoss
authored andcommitted
drm/bridge: tc358775: Add support for tc358765
The tc358775 bridge is pin compatible with earlier tc358765 according to the tc358774xbg_datasheet_en_20190118.pdf documentation. Compared to the tc358765, the tc358775 supports a STBY GPIO and higher data rates. The tc358765 has a register bit for video event mode vs video pulse mode. We must set it to video event mode for the LCD output to work, and on the tc358775, this bit no longer exists. Looks like the registers seem to match otherwise based on a quick glance comparing the defines to the earlier Android kernel tc358765 driver. Reviewed-by: Michael Walle <mwalle@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Robert Foss <rfoss@kernel.org> Signed-off-by: Robert Foss <rfoss@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20240225062008.33191-10-tony@atomide.com
1 parent e2ee8e8 commit ce2196d

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

drivers/gpu/drm/bridge/tc358775.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/kernel.h>
1616
#include <linux/media-bus-format.h>
1717
#include <linux/module.h>
18+
#include <linux/of_device.h>
1819
#include <linux/regulator/consumer.h>
1920
#include <linux/slab.h>
2021

@@ -107,6 +108,7 @@
107108
#define RDPKTLN 0x0404 /* Command Read Packet Length */
108109

109110
#define VPCTRL 0x0450 /* Video Path Control */
111+
#define EVTMODE BIT(5) /* Video event mode enable, tc35876x only */
110112
#define HTIM1 0x0454 /* Horizontal Timing Control 1 */
111113
#define HTIM2 0x0458 /* Horizontal Timing Control 2 */
112114
#define VTIM1 0x045C /* Vertical Timing Control 1 */
@@ -254,6 +256,11 @@ enum tc358775_ports {
254256
TC358775_LVDS_OUT1,
255257
};
256258

259+
enum tc3587x5_type {
260+
TC358765 = 0x65,
261+
TC358775 = 0x75,
262+
};
263+
257264
struct tc_data {
258265
struct i2c_client *i2c;
259266
struct device *dev;
@@ -271,6 +278,8 @@ struct tc_data {
271278
struct gpio_desc *stby_gpio;
272279
u8 lvds_link; /* single-link or dual-link */
273280
u8 bpc;
281+
282+
enum tc3587x5_type type;
274283
};
275284

276285
static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
@@ -424,10 +433,16 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
424433
d2l_write(tc->i2c, PPI_STARTPPI, PPI_START_FUNCTION);
425434
d2l_write(tc->i2c, DSI_STARTDSI, DSI_RX_START);
426435

436+
/* Video event mode vs pulse mode bit, does not exist for tc358775 */
437+
if (tc->type == TC358765)
438+
val = EVTMODE;
439+
else
440+
val = 0;
441+
427442
if (tc->bpc == 8)
428-
val = TC358775_VPCTRL_OPXLFMT(1);
443+
val |= TC358775_VPCTRL_OPXLFMT(1);
429444
else /* bpc = 6; */
430-
val = TC358775_VPCTRL_MSF(1);
445+
val |= TC358775_VPCTRL_MSF(1);
431446

432447
dsiclk = mode->crtc_clock * 3 * tc->bpc / tc->num_dsi_lanes / 1000;
433448
clkdiv = dsiclk / (tc->lvds_link == DUAL_LINK ? DIVIDE_BY_6 : DIVIDE_BY_3);
@@ -641,6 +656,7 @@ static int tc_probe(struct i2c_client *client)
641656

642657
tc->dev = dev;
643658
tc->i2c = client;
659+
tc->type = (enum tc3587x5_type)(unsigned long)of_device_get_match_data(dev);
644660

645661
tc->panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node,
646662
TC358775_LVDS_OUT0, 0);
@@ -702,13 +718,15 @@ static void tc_remove(struct i2c_client *client)
702718
}
703719

704720
static const struct i2c_device_id tc358775_i2c_ids[] = {
705-
{ "tc358775", 0 },
721+
{ "tc358765", TC358765, },
722+
{ "tc358775", TC358775, },
706723
{ }
707724
};
708725
MODULE_DEVICE_TABLE(i2c, tc358775_i2c_ids);
709726

710727
static const struct of_device_id tc358775_of_ids[] = {
711-
{ .compatible = "toshiba,tc358775", },
728+
{ .compatible = "toshiba,tc358765", .data = (void *)TC358765, },
729+
{ .compatible = "toshiba,tc358775", .data = (void *)TC358775, },
712730
{ }
713731
};
714732
MODULE_DEVICE_TABLE(of, tc358775_of_ids);

0 commit comments

Comments
 (0)