#include <linux/device.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/media-bus-format.h>
#include <linux/regmap.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_edid.h>
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_of.h>
#include <video/videomode.h>
#define I2C_MAIN …
#define I2C_ADDR_MAIN …
#define I2C_CEC_DSI …
#define I2C_ADDR_CEC_DSI …
#define I2C_MAX_IDX …
struct lt8912 { … };
static int lt8912_write_init_config(struct lt8912 *lt)
{ … }
static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
{
const struct reg_sequence seq[] = {
{0x12, 0x04},
{0x14, 0x00},
{0x15, 0x00},
{0x1a, 0x03},
{0x1b, 0x03},
};
return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, ARRAY_SIZE(seq));
};
static int lt8912_write_dds_config(struct lt8912 *lt)
{ … }
static int lt8912_write_rxlogicres_config(struct lt8912 *lt)
{
int ret;
ret = regmap_write(lt->regmap[I2C_MAIN], 0x03, 0x7f);
usleep_range(10000, 20000);
ret |= regmap_write(lt->regmap[I2C_MAIN], 0x03, 0xff);
return ret;
};
static int lt8912_write_lvds_config(struct lt8912 *lt)
{
const struct reg_sequence seq[] = {
{0x44, 0x30},
{0x51, 0x05},
{0x50, 0x24},
{0x51, 0x2d},
{0x52, 0x04},
{0x69, 0x0e},
{0x69, 0x8e},
{0x6a, 0x00},
{0x6c, 0xb8},
{0x6b, 0x51},
{0x04, 0xfb},
{0x04, 0xff},
{0x7f, 0x00},
{0xa8, 0x13},
{0x02, 0xf7},
{0x02, 0xff},
{0x03, 0xcf},
{0x03, 0xff},
};
return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, ARRAY_SIZE(seq));
};
static inline struct lt8912 *bridge_to_lt8912(struct drm_bridge *b)
{ … }
static inline struct lt8912 *connector_to_lt8912(struct drm_connector *c)
{ … }
static const struct regmap_config lt8912_regmap_config = …;
static int lt8912_init_i2c(struct lt8912 *lt, struct i2c_client *client)
{ … }
static int lt8912_free_i2c(struct lt8912 *lt)
{ … }
static int lt8912_hard_power_on(struct lt8912 *lt)
{ … }
static void lt8912_hard_power_off(struct lt8912 *lt)
{ … }
static int lt8912_video_setup(struct lt8912 *lt)
{ … }
static int lt8912_soft_power_on(struct lt8912 *lt)
{ … }
static int lt8912_video_on(struct lt8912 *lt)
{ … }
static enum drm_connector_status lt8912_check_cable_status(struct lt8912 *lt)
{ … }
static enum drm_connector_status
lt8912_connector_detect(struct drm_connector *connector, bool force)
{ … }
static const struct drm_connector_funcs lt8912_connector_funcs = …;
static enum drm_mode_status
lt8912_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{ … }
static int lt8912_connector_get_modes(struct drm_connector *connector)
{ … }
static const struct drm_connector_helper_funcs lt8912_connector_helper_funcs = …;
static void lt8912_bridge_mode_set(struct drm_bridge *bridge,
const struct drm_display_mode *mode,
const struct drm_display_mode *adj)
{ … }
static void lt8912_bridge_enable(struct drm_bridge *bridge)
{ … }
static int lt8912_attach_dsi(struct lt8912 *lt)
{ … }
static void lt8912_bridge_hpd_cb(void *data, enum drm_connector_status status)
{ … }
static int lt8912_bridge_connector_init(struct drm_bridge *bridge)
{ … }
static int lt8912_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{ … }
static void lt8912_bridge_detach(struct drm_bridge *bridge)
{ … }
static enum drm_connector_status
lt8912_bridge_detect(struct drm_bridge *bridge)
{ … }
static const struct drm_edid *lt8912_bridge_edid_read(struct drm_bridge *bridge,
struct drm_connector *connector)
{ … }
static const struct drm_bridge_funcs lt8912_bridge_funcs = …;
static int lt8912_bridge_resume(struct device *dev)
{ … }
static int lt8912_bridge_suspend(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(lt8912_bridge_pm_ops, lt8912_bridge_suspend, lt8912_bridge_resume);
static int lt8912_get_regulators(struct lt8912 *lt)
{ … }
static int lt8912_parse_dt(struct lt8912 *lt)
{ … }
static int lt8912_put_dt(struct lt8912 *lt)
{ … }
static int lt8912_probe(struct i2c_client *client)
{ … }
static void lt8912_remove(struct i2c_client *client)
{ … }
static const struct of_device_id lt8912_dt_match[] = …;
MODULE_DEVICE_TABLE(of, lt8912_dt_match);
static const struct i2c_device_id lt8912_id[] = …;
MODULE_DEVICE_TABLE(i2c, lt8912_id);
static struct i2c_driver lt8912_i2c_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;