Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57e376ac authored by Ajay Singh Parmar's avatar Ajay Singh Parmar
Browse files

msm: mdss: hdmi: separate out hdmi panel functionalities



Create a new file for hdmi panel related functionalities
for a cleaner approach. Move all the video, infoframe and
timing related programming to hdmi panel. Expose its
functionalities for other modules. Register the panel with
hdmi transmitter core so that it can access and program it.

Change-Id: Iff1cb13d7b42b6ecfe6fd1fc88a111875c3d6cfa
Signed-off-by: default avatarAjay Singh Parmar <aparmar@codeaurora.org>
parent 8f4978ef
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ obj-$(CONFIG_FB_MSM_MDSS_EDP_PANEL) += mdss_edp_aux.o

obj-$(CONFIG_FB_MSM_MDSS) += mdss_io_util.o
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_tx.o
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_panel.o
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_hdcp.o
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_hdcp2p2.o
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_cec.o
+932 −0

File added.

Preview size limit exceeded, changes collapsed.

+107 −0
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __MDSS_HDMI_PANEL_H__
#define __MDSS_HDMI_PANEL_H__

#include "mdss_panel.h"
#include "mdss_hdmi_util.h"

/**
 * struct hdmi_panel_data - panel related data information
 *
 * @pinfo: pointer to mdss panel information
 * @s3d_mode: 3d mode supported
 * @vic: video indentification code
 * @scan_info: scan information of the TV
 * @s3d_support: set to true if 3d supported, false otherwize
 * @content_type: type of content like game, cinema etc
 * @infoframe: set to true if infoframes should be sent to sink
 * @is_it_content: set to true if content is IT
 * @scrambler: set to true if scrambler needs to be enabled
 */
struct hdmi_panel_data {
	struct mdss_panel_info *pinfo;
	u32 s3d_mode;
	u32 vic;
	u32 scan_info;
	u8 content_type;
	bool s3d_support;
	bool infoframe;
	bool is_it_content;
	bool scrambler;
};

/**
 * struct hdmi_panel_ops - panel operation for clients
 *
 * @on: pointer to a function which powers on the panel
 * @off: pointer to a function which powers off the panel
 * @vendor: pointer to a function which programs vendor specific infoframe
 * @update_fps: pointer to a function which updates fps
 * @get_vic: pointer to a function which get the vic from panel information.
 */
struct hdmi_panel_ops {
	int (*on)(void *input);
	int (*off)(void *input);
	void (*vendor)(void *input);
	int (*update_fps)(void *input, u32 fps);
	int (*get_vic)(struct mdss_panel_info *pinfo,
		struct hdmi_util_ds_data *ds_data);
};

/**
 * struct hdmi_panel_init_data - initialization data for hdmi panel
 *
 * @io: pointer to logical memory of the hdmi tx core
 * @ds_data: pointer to down stream data
 * @panel_data: pointer to panel data
 * @ddc: pointer to display data channel's data
 * @ops: pointer to pnael ops to be filled by hdmi panel
 * @timing: pointer to the timing details of current resolution
 * @spd_vendor_name: pointer to spd vendor infoframe data
 * @spd_product_description:  pointer to spd product description infoframe data
 * @version:  hardware version of the hdmi tx
 */
struct hdmi_panel_init_data {
	struct dss_io_data *io;
	struct hdmi_util_ds_data *ds_data;
	struct hdmi_panel_data *panel_data;
	struct hdmi_tx_ddc_ctrl *ddc;
	struct hdmi_panel_ops *ops;
	struct msm_hdmi_mode_timing_info *timing;
	u8 *spd_vendor_name;
	u8 *spd_product_description;
	u32 version;
};

/**
 * hdmi_panel_init() - initializes hdmi panel
 *
 * initializes the hdmi panel, allocates the memory, assign the input
 * data to local variables and provide the operation function pointers.
 *
 * @data: initialization data.
 * return: hdmi panel data that need to be send with hdmi ops.
 */
void *hdmi_panel_init(struct hdmi_panel_init_data *data);

/**
 * hdmi_panel_deinit() - deinitializes hdmi panel
 *
 * releases memory and all resources.
 *
 * @input: hdmi panel data.
 */
void hdmi_panel_deinit(void *input);

#endif /* __MDSS_HDMI_PANEL_H__ */
+131 −1046

File changed.

Preview size limit exceeded, changes collapsed.

+34 −104
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@

#include <linux/switch.h>
#include "mdss_hdmi_util.h"
#include "mdss_hdmi_panel.h"
#include "mdss_cec_core.h"
#include "mdss_hdmi_audio.h"

@@ -57,155 +58,84 @@ struct hdmi_tx_pinctrl {
	struct pinctrl_state *state_suspend;
};

enum hdmi_scan_info {
	HDMI_SCAN_DEFAULT,
	HDMI_SCAN_OVERSCAN,
	HDMI_SCAN_UNDERSCAN,
};

enum hdmi_colorimetry_info {
	HDMI_COLORIMETRY_SMPTE170M,
	HDMI_COLORIMETRY_ITUR_BT_709,
	HDMI_COLORIMETRY_ADOBE_RGB,
	HDMI_COLORIMETRY_ADOBE_YCC601,
	HDMI_COLORIMETRY_ITUR_BT_2020
};

enum hdmi_quantization_range {
	HDMI_QUANTIZATION_DEFAULT,
	HDMI_QUANTIZATION_LIMITED_RANGE,
	HDMI_QUANTIZATION_FULL_RANGE
};

enum hdmi_scaling_info {
	HDMI_SCALING_NONE,
	HDMI_SCALING_HORZ,
	HDMI_SCALING_VERT,
	HDMI_SCALING_HORZ_VERT,
};

enum hdmi_avi_content_type {
	HDMI_CONTENT_GRAPHICS,
	HDMI_CONTENT_PHOTO,
	HDMI_CONTENT_CINEMA,
	HDMI_CONTENT_GAME,
};

struct hdmi_avi_iframe_bar_info {
	bool vert_binfo_present;
	bool horz_binfo_present;
	u32 end_of_top_bar;
	u32 start_of_bottom_bar;
	u32 end_of_left_bar;
	u32 start_of_right_bar;
};

struct hdmi_avi_infoframe_config {
	u32 pixel_format;
	u32 scan_info;
	bool act_fmt_info_present;
	u32 colorimetry_info;
	u32 ext_colorimetry_info;
	u32 rgb_quantization_range;
	u32 yuv_quantization_range;
	u32 scaling_info;
	bool is_it_content;
	u8 content_type;
	u8 pixel_rpt_factor;
	struct hdmi_avi_iframe_bar_info bar_info;
};

struct hdmi_video_config {
	u32 vic;
	struct msm_hdmi_mode_timing_info timing;
	struct hdmi_avi_infoframe_config avi_iframe;
};

struct hdmi_tx_ctrl;
typedef int (*hdmi_tx_evt_handler) (struct hdmi_tx_ctrl *);

struct hdmi_tx_ctrl {
	struct platform_device *pdev;
	u32 hdmi_tx_ver;
	u32 max_pclk_khz;
	struct hdmi_tx_platform_data pdata;
	struct mdss_panel_data panel_data;
	struct mdss_util_intf *mdss_util;


	struct msm_hdmi_mode_timing_info timing;
	struct hdmi_tx_pinctrl pin_res;

	struct mutex mutex;
	struct mutex tx_lock;
	struct list_head cable_notify_handlers;
	struct kobject *kobj;
	struct switch_dev sdev;
	struct workqueue_struct *workq;
	spinlock_t hpd_state_lock;
	struct hdmi_util_ds_data ds_data;
	struct completion hpd_int_done;
	struct work_struct hpd_int_work;
	struct delayed_work hdcp_cb_work;
	struct work_struct cable_notify_work;
	struct hdmi_tx_ddc_ctrl ddc_ctrl;
	struct hdmi_hdcp_ops *hdcp_ops;
	struct cec_ops hdmi_cec_ops;
	struct cec_cbs hdmi_cec_cbs;
	struct hdmi_audio_ops audio_ops;
	struct msm_hdmi_audio_setup_params audio_params;
	struct hdmi_panel_data panel;
	struct hdmi_panel_ops panel_ops;
	struct work_struct fps_work;

	struct hdmi_video_config vid_cfg;
	spinlock_t hpd_state_lock;

	u32 panel_power_on;
	u32 panel_suspend;

	u32 vic;
	u32 hdmi_tx_ver;
	u32 max_pclk_khz;
	u32 hpd_state;
	u32 hpd_off_pending;
	u32 hpd_feature_on;
	u32 hpd_initialized;
	u32 vote_hdmi_core_on;
	u32 dynamic_fps;
	u32 hdcp14_present;
	u32 enc_lvl;
	u32 edid_buf_size;
	u32 s3d_mode;

	u8 timing_gen_on;
	u8 mhl_hpd_on;
	u8 hdcp_status;

	struct hdmi_util_ds_data ds_data;
	struct completion hpd_int_done;
	struct work_struct hpd_int_work;
	struct work_struct fps_work;
	struct delayed_work hdcp_cb_work;

	struct work_struct cable_notify_work;
	u8 spd_vendor_name[9];
	u8 spd_product_description[17];

	bool hdcp_feature_on;
	bool hpd_disabled;
	bool ds_registered;
	bool scrambler_enabled;
	u32 hdcp14_present;
	bool hdcp1_use_sw_keys;
	bool hdcp14_sw_keys;
	bool auth_state;
	bool custom_edid;
	bool sim_mode;
	u32 enc_lvl;

	u8 spd_vendor_name[9];
	u8 spd_product_description[17];

	struct hdmi_tx_ddc_ctrl ddc_ctrl;
	bool hdcp22_present;
	bool power_data_enable[HDMI_TX_MAX_PM];

	void (*hdmi_tx_hpd_done)(void *data);
	void *downstream_data;
	void *audio_data;

	void *feature_data[hweight8(HDMI_TX_FEAT_MAX)];
	struct hdmi_hdcp_ops *hdcp_ops;
	void *hdcp_data;
	bool hdcp22_present;

	void *evt_arg;
	u8 *edid_buf;
	u32 edid_buf_size;
	u32 s3d_mode;

	struct cec_ops hdmi_cec_ops;
	struct cec_cbs hdmi_cec_cbs;
	struct hdmi_audio_ops audio_ops;
	struct msm_hdmi_audio_setup_params audio_params;

	char disp_switch_name[MAX_SWITCH_NAME_SIZE];
	bool power_data_enable[HDMI_TX_MAX_PM];

	hdmi_tx_evt_handler evt_handler[MDSS_EVENT_MAX];
	void *evt_arg;
	hdmi_tx_evt_handler evt_handler[MDSS_EVENT_MAX - 1];
};

#endif /* __MDSS_HDMI_TX_H__ */
Loading