linux/drivers/gpu/drm/bridge/analogix/anx7625.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright(c) 2020, Analogix Semiconductor. All rights reserved.
 *
 */
#include <linux/gcd.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/workqueue.h>

#include <linux/of_graph.h>
#include <linux/of_platform.h>

#include <drm/display/drm_dp_aux_bus.h>
#include <drm/display/drm_dp_helper.h>
#include <drm/display/drm_hdcp_helper.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_edid.h>
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_of.h>
#include <drm/drm_panel.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>

#include <media/v4l2-fwnode.h>
#include <sound/hdmi-codec.h>
#include <video/display_timing.h>

#include "anx7625.h"

/*
 * There is a sync issue while access I2C register between AP(CPU) and
 * internal firmware(OCM), to avoid the race condition, AP should access
 * the reserved slave address before slave address occurs changes.
 */
static int i2c_access_workaround(struct anx7625_data *ctx,
				 struct i2c_client *client)
{}

static int anx7625_reg_read(struct anx7625_data *ctx,
			    struct i2c_client *client, u8 reg_addr)
{}

static int anx7625_reg_block_read(struct anx7625_data *ctx,
				  struct i2c_client *client,
				  u8 reg_addr, u8 len, u8 *buf)
{}

static int anx7625_reg_write(struct anx7625_data *ctx,
			     struct i2c_client *client,
			     u8 reg_addr, u8 reg_val)
{}

static int anx7625_reg_block_write(struct anx7625_data *ctx,
				   struct i2c_client *client,
				   u8 reg_addr, u8 len, u8 *buf)
{}

static int anx7625_write_or(struct anx7625_data *ctx,
			    struct i2c_client *client,
			    u8 offset, u8 mask)
{}

static int anx7625_write_and(struct anx7625_data *ctx,
			     struct i2c_client *client,
			     u8 offset, u8 mask)
{}

static int anx7625_write_and_or(struct anx7625_data *ctx,
				struct i2c_client *client,
				u8 offset, u8 and_mask, u8 or_mask)
{}

static int anx7625_config_bit_matrix(struct anx7625_data *ctx)
{}

static int anx7625_read_ctrl_status_p0(struct anx7625_data *ctx)
{}

static int wait_aux_op_finish(struct anx7625_data *ctx)
{}

static int anx7625_aux_trans(struct anx7625_data *ctx, u8 op, u32 address,
			     u8 len, u8 *buf)
{}

static int anx7625_video_mute_control(struct anx7625_data *ctx,
				      u8 status)
{}

/* Reduction of fraction a/b */
static void anx7625_reduction_of_a_fraction(unsigned long *a, unsigned long *b)
{}

static int anx7625_calculate_m_n(u32 pixelclock,
				 unsigned long *m,
				 unsigned long *n,
				 u8 *post_divider)
{}

static int anx7625_odfc_config(struct anx7625_data *ctx,
			       u8 post_divider)
{}

/*
 * The MIPI source video data exist large variation (e.g. 59Hz ~ 61Hz),
 * anx7625 defined K ratio for matching MIPI input video clock and
 * DP output video clock. Increase K value can match bigger video data
 * variation. IVO panel has small variation than DP CTS spec, need
 * decrease the K value.
 */
static int anx7625_set_k_value(struct anx7625_data *ctx)
{}

static int anx7625_dsi_video_timing_config(struct anx7625_data *ctx)
{}

static int anx7625_swap_dsi_lane3(struct anx7625_data *ctx)
{}

static int anx7625_api_dsi_config(struct anx7625_data *ctx)

{}

static int anx7625_dsi_config(struct anx7625_data *ctx)
{}

static int anx7625_api_dpi_config(struct anx7625_data *ctx)
{}

static int anx7625_dpi_config(struct anx7625_data *ctx)
{}

static int anx7625_read_flash_status(struct anx7625_data *ctx)
{}

static int anx7625_hdcp_key_probe(struct anx7625_data *ctx)
{}

static int anx7625_hdcp_key_load(struct anx7625_data *ctx)
{}

static int anx7625_hdcp_disable(struct anx7625_data *ctx)
{}

static int anx7625_hdcp_enable(struct anx7625_data *ctx)
{}

static void anx7625_dp_start(struct anx7625_data *ctx)
{}

static void anx7625_dp_stop(struct anx7625_data *ctx)
{}

static int sp_tx_rst_aux(struct anx7625_data *ctx)
{}

static int sp_tx_aux_wr(struct anx7625_data *ctx, u8 offset)
{}

static int sp_tx_aux_rd(struct anx7625_data *ctx, u8 len_cmd)
{}

static int sp_tx_get_edid_block(struct anx7625_data *ctx)
{}

static int edid_read(struct anx7625_data *ctx,
		     u8 offset, u8 *pblock_buf)
{}

static int segments_edid_read(struct anx7625_data *ctx,
			      u8 segment, u8 *buf, u8 offset)
{}

static int sp_tx_edid_read(struct anx7625_data *ctx,
			   u8 *pedid_blocks_buf)
{}

static void anx7625_power_on(struct anx7625_data *ctx)
{}

static void anx7625_power_standby(struct anx7625_data *ctx)
{}

/* Basic configurations of ANX7625 */
static void anx7625_config(struct anx7625_data *ctx)
{}

static int anx7625_hpd_timer_config(struct anx7625_data *ctx)
{}

static int anx7625_read_hpd_gpio_config_status(struct anx7625_data *ctx)
{}

static void anx7625_disable_pd_protocol(struct anx7625_data *ctx)
{}

static int anx7625_ocm_loading_check(struct anx7625_data *ctx)
{}

static void anx7625_power_on_init(struct anx7625_data *ctx)
{}

static void anx7625_init_gpio(struct anx7625_data *platform)
{}

static void anx7625_stop_dp_work(struct anx7625_data *ctx)
{}

static void anx7625_start_dp_work(struct anx7625_data *ctx)
{}

static int anx7625_read_hpd_status_p0(struct anx7625_data *ctx)
{}

static int _anx7625_hpd_polling(struct anx7625_data *ctx,
				unsigned long wait_us)
{}

static int anx7625_wait_hpd_asserted(struct drm_dp_aux *aux,
				     unsigned long wait_us)
{}

static void anx7625_remove_edid(struct anx7625_data *ctx)
{}

static void anx7625_dp_adjust_swing(struct anx7625_data *ctx)
{}

static void dp_hpd_change_handler(struct anx7625_data *ctx, bool on)
{}

static int anx7625_hpd_change_detect(struct anx7625_data *ctx)
{}

static void anx7625_work_func(struct work_struct *work)
{}

static irqreturn_t anx7625_intr_hpd_isr(int irq, void *data)
{}

static int anx7625_get_swing_setting(struct device *dev,
				     struct anx7625_platform_data *pdata)
{}

static int anx7625_parse_dt(struct device *dev,
			    struct anx7625_platform_data *pdata)
{}

static int anx7625_parse_dt_panel(struct device *dev,
				  struct anx7625_platform_data *pdata)
{}

static bool anx7625_of_panel_on_aux_bus(struct device *dev)
{}

static inline struct anx7625_data *bridge_to_anx7625(struct drm_bridge *bridge)
{}

static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux,
				    struct drm_dp_aux_msg *msg)
{}

static const struct drm_edid *anx7625_edid_read(struct anx7625_data *ctx)
{}

static enum drm_connector_status anx7625_sink_detect(struct anx7625_data *ctx)
{}

static int anx7625_audio_hw_params(struct device *dev, void *data,
				   struct hdmi_codec_daifmt *fmt,
				   struct hdmi_codec_params *params)
{}

static void anx7625_audio_shutdown(struct device *dev, void *data)
{}

static int anx7625_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
				       struct device_node *endpoint)
{}

static void
anx7625_audio_update_connector_status(struct anx7625_data *ctx,
				      enum drm_connector_status status)
{}

static int anx7625_audio_hook_plugged_cb(struct device *dev, void *data,
					 hdmi_codec_plugged_cb fn,
					 struct device *codec_dev)
{}

static int anx7625_audio_get_eld(struct device *dev, void *data,
				 u8 *buf, size_t len)
{}

static const struct hdmi_codec_ops anx7625_codec_ops =;

static void anx7625_unregister_audio(struct anx7625_data *ctx)
{}

static int anx7625_register_audio(struct device *dev, struct anx7625_data *ctx)
{}

static int anx7625_setup_dsi_device(struct anx7625_data *ctx)
{}

static int anx7625_attach_dsi(struct anx7625_data *ctx)
{}

static void hdcp_check_work_func(struct work_struct *work)
{}

static int anx7625_connector_atomic_check(struct anx7625_data *ctx,
					  struct drm_connector_state *state)
{}

static int anx7625_bridge_attach(struct drm_bridge *bridge,
				 enum drm_bridge_attach_flags flags)
{}

static void anx7625_bridge_detach(struct drm_bridge *bridge)
{}

static enum drm_mode_status
anx7625_bridge_mode_valid(struct drm_bridge *bridge,
			  const struct drm_display_info *info,
			  const struct drm_display_mode *mode)
{}

static void anx7625_bridge_mode_set(struct drm_bridge *bridge,
				    const struct drm_display_mode *old_mode,
				    const struct drm_display_mode *mode)
{}

static bool anx7625_bridge_mode_fixup(struct drm_bridge *bridge,
				      const struct drm_display_mode *mode,
				      struct drm_display_mode *adj)
{}

static int anx7625_bridge_atomic_check(struct drm_bridge *bridge,
				       struct drm_bridge_state *bridge_state,
				       struct drm_crtc_state *crtc_state,
				       struct drm_connector_state *conn_state)
{}

static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,
					 struct drm_bridge_state *state)
{}

static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,
					  struct drm_bridge_state *old)
{}

static void
anx7625_audio_update_connector_status(struct anx7625_data *ctx,
				      enum drm_connector_status status);

static enum drm_connector_status
anx7625_bridge_detect(struct drm_bridge *bridge)
{}

static const struct drm_edid *anx7625_bridge_edid_read(struct drm_bridge *bridge,
						       struct drm_connector *connector)
{}

static const struct drm_bridge_funcs anx7625_bridge_funcs =;

static int anx7625_register_i2c_dummy_clients(struct anx7625_data *ctx,
					      struct i2c_client *client)
{}

static int __maybe_unused anx7625_runtime_pm_suspend(struct device *dev)
{}

static int __maybe_unused anx7625_runtime_pm_resume(struct device *dev)
{}

static const struct dev_pm_ops anx7625_pm_ops =;

static void anx7625_runtime_disable(void *data)
{}

static int anx7625_link_bridge(struct drm_dp_aux *aux)
{}

static int anx7625_i2c_probe(struct i2c_client *client)
{}

static void anx7625_i2c_remove(struct i2c_client *client)
{}

static const struct i2c_device_id anx7625_id[] =;

MODULE_DEVICE_TABLE(i2c, anx7625_id);

static const struct of_device_id anx_match_table[] =;
MODULE_DEVICE_TABLE(of, anx_match_table);

static struct i2c_driver anx7625_driver =;

module_i2c_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_VERSION();