drm/gma500: Rename psb_intel_encoder to gma_encoder
The psb_intel_encoder is generic and should be named appropriately Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
This commit is contained in:
parent
a3d5d75f69
commit
367e44080e
@ -196,10 +196,9 @@ static enum drm_connector_status cdv_intel_crt_detect(
|
||||
|
||||
static void cdv_intel_crt_destroy(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
|
||||
psb_intel_i2c_destroy(psb_intel_encoder->ddc_bus);
|
||||
psb_intel_i2c_destroy(gma_encoder->ddc_bus);
|
||||
drm_sysfs_connector_remove(connector);
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(connector);
|
||||
@ -207,9 +206,9 @@ static void cdv_intel_crt_destroy(struct drm_connector *connector)
|
||||
|
||||
static int cdv_intel_crt_get_modes(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
return psb_intel_ddc_get_modes(connector, &psb_intel_encoder->ddc_bus->adapter);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
return psb_intel_ddc_get_modes(connector,
|
||||
&gma_encoder->ddc_bus->adapter);
|
||||
}
|
||||
|
||||
static int cdv_intel_crt_set_property(struct drm_connector *connector,
|
||||
@ -260,14 +259,14 @@ void cdv_intel_crt_init(struct drm_device *dev,
|
||||
{
|
||||
|
||||
struct gma_connector *gma_connector;
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
|
||||
u32 i2c_reg;
|
||||
|
||||
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL);
|
||||
if (!psb_intel_encoder)
|
||||
gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
|
||||
if (!gma_encoder)
|
||||
return;
|
||||
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
|
||||
@ -279,11 +278,11 @@ void cdv_intel_crt_init(struct drm_device *dev,
|
||||
drm_connector_init(dev, connector,
|
||||
&cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
|
||||
|
||||
encoder = &psb_intel_encoder->base;
|
||||
encoder = &gma_encoder->base;
|
||||
drm_encoder_init(dev, encoder,
|
||||
&cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC);
|
||||
|
||||
gma_connector_attach_encoder(gma_connector, psb_intel_encoder);
|
||||
gma_connector_attach_encoder(gma_connector, gma_encoder);
|
||||
|
||||
/* Set up the DDC bus. */
|
||||
i2c_reg = GPIOA;
|
||||
@ -292,15 +291,15 @@ void cdv_intel_crt_init(struct drm_device *dev,
|
||||
if (dev_priv->crt_ddc_bus != 0)
|
||||
i2c_reg = dev_priv->crt_ddc_bus;
|
||||
}*/
|
||||
psb_intel_encoder->ddc_bus = psb_intel_i2c_create(dev,
|
||||
gma_encoder->ddc_bus = psb_intel_i2c_create(dev,
|
||||
i2c_reg, "CRTDDC_A");
|
||||
if (!psb_intel_encoder->ddc_bus) {
|
||||
if (!gma_encoder->ddc_bus) {
|
||||
dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
|
||||
"failed.\n");
|
||||
goto failed_ddc;
|
||||
}
|
||||
|
||||
psb_intel_encoder->type = INTEL_OUTPUT_ANALOG;
|
||||
gma_encoder->type = INTEL_OUTPUT_ANALOG;
|
||||
/*
|
||||
psb_intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT);
|
||||
psb_intel_output->crtc_mask = (1 << 0) | (1 << 1);
|
||||
@ -316,10 +315,10 @@ void cdv_intel_crt_init(struct drm_device *dev,
|
||||
|
||||
return;
|
||||
failed_ddc:
|
||||
drm_encoder_cleanup(&psb_intel_encoder->base);
|
||||
drm_encoder_cleanup(&gma_encoder->base);
|
||||
drm_connector_cleanup(&gma_connector->base);
|
||||
kfree(gma_connector);
|
||||
failed_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
return;
|
||||
}
|
||||
|
@ -497,14 +497,14 @@ static bool is_pipeb_lvds(struct drm_device *dev, struct drm_crtc *crtc)
|
||||
return false;
|
||||
|
||||
list_for_each_entry(connector, &mode_config->connector_list, head) {
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
struct gma_encoder *gma_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
|
||||
if (!connector->encoder
|
||||
|| connector->encoder->crtc != crtc)
|
||||
continue;
|
||||
|
||||
if (psb_intel_encoder->type == INTEL_OUTPUT_LVDS)
|
||||
if (gma_encoder->type == INTEL_OUTPUT_LVDS)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -632,15 +632,15 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
|
||||
bool is_edp = false;
|
||||
|
||||
list_for_each_entry(connector, &mode_config->connector_list, head) {
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
struct gma_encoder *gma_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
|
||||
if (!connector->encoder
|
||||
|| connector->encoder->crtc != crtc)
|
||||
continue;
|
||||
|
||||
ddi_select = psb_intel_encoder->ddi_select;
|
||||
switch (psb_intel_encoder->type) {
|
||||
ddi_select = gma_encoder->ddi_select;
|
||||
switch (gma_encoder->type) {
|
||||
case INTEL_OUTPUT_LVDS:
|
||||
is_lvds = true;
|
||||
break;
|
||||
|
@ -69,7 +69,7 @@ struct cdv_intel_dp {
|
||||
uint8_t link_bw;
|
||||
uint8_t lane_count;
|
||||
uint8_t dpcd[4];
|
||||
struct psb_intel_encoder *encoder;
|
||||
struct gma_encoder *encoder;
|
||||
struct i2c_adapter adapter;
|
||||
struct i2c_algo_dp_aux_data algo;
|
||||
uint8_t train_set[4];
|
||||
@ -115,18 +115,18 @@ static uint32_t dp_vswing_premph_table[] = {
|
||||
* If a CPU or PCH DP output is attached to an eDP panel, this function
|
||||
* will return true, and false otherwise.
|
||||
*/
|
||||
static bool is_edp(struct psb_intel_encoder *encoder)
|
||||
static bool is_edp(struct gma_encoder *encoder)
|
||||
{
|
||||
return encoder->type == INTEL_OUTPUT_EDP;
|
||||
}
|
||||
|
||||
|
||||
static void cdv_intel_dp_start_link_train(struct psb_intel_encoder *encoder);
|
||||
static void cdv_intel_dp_complete_link_train(struct psb_intel_encoder *encoder);
|
||||
static void cdv_intel_dp_link_down(struct psb_intel_encoder *encoder);
|
||||
static void cdv_intel_dp_start_link_train(struct gma_encoder *encoder);
|
||||
static void cdv_intel_dp_complete_link_train(struct gma_encoder *encoder);
|
||||
static void cdv_intel_dp_link_down(struct gma_encoder *encoder);
|
||||
|
||||
static int
|
||||
cdv_intel_dp_max_lane_count(struct psb_intel_encoder *encoder)
|
||||
cdv_intel_dp_max_lane_count(struct gma_encoder *encoder)
|
||||
{
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
int max_lane_count = 4;
|
||||
@ -144,7 +144,7 @@ cdv_intel_dp_max_lane_count(struct psb_intel_encoder *encoder)
|
||||
}
|
||||
|
||||
static int
|
||||
cdv_intel_dp_max_link_bw(struct psb_intel_encoder *encoder)
|
||||
cdv_intel_dp_max_link_bw(struct gma_encoder *encoder)
|
||||
{
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
int max_link_bw = intel_dp->dpcd[DP_MAX_LINK_RATE];
|
||||
@ -181,7 +181,7 @@ cdv_intel_dp_max_data_rate(int max_link_clock, int max_lanes)
|
||||
return (max_link_clock * max_lanes * 19) / 20;
|
||||
}
|
||||
|
||||
static void cdv_intel_edp_panel_vdd_on(struct psb_intel_encoder *intel_encoder)
|
||||
static void cdv_intel_edp_panel_vdd_on(struct gma_encoder *intel_encoder)
|
||||
{
|
||||
struct drm_device *dev = intel_encoder->base.dev;
|
||||
struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
|
||||
@ -201,7 +201,7 @@ static void cdv_intel_edp_panel_vdd_on(struct psb_intel_encoder *intel_encoder)
|
||||
msleep(intel_dp->panel_power_up_delay);
|
||||
}
|
||||
|
||||
static void cdv_intel_edp_panel_vdd_off(struct psb_intel_encoder *intel_encoder)
|
||||
static void cdv_intel_edp_panel_vdd_off(struct gma_encoder *intel_encoder)
|
||||
{
|
||||
struct drm_device *dev = intel_encoder->base.dev;
|
||||
u32 pp;
|
||||
@ -216,7 +216,7 @@ static void cdv_intel_edp_panel_vdd_off(struct psb_intel_encoder *intel_encoder)
|
||||
}
|
||||
|
||||
/* Returns true if the panel was already on when called */
|
||||
static bool cdv_intel_edp_panel_on(struct psb_intel_encoder *intel_encoder)
|
||||
static bool cdv_intel_edp_panel_on(struct gma_encoder *intel_encoder)
|
||||
{
|
||||
struct drm_device *dev = intel_encoder->base.dev;
|
||||
struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
|
||||
@ -243,7 +243,7 @@ static bool cdv_intel_edp_panel_on(struct psb_intel_encoder *intel_encoder)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void cdv_intel_edp_panel_off (struct psb_intel_encoder *intel_encoder)
|
||||
static void cdv_intel_edp_panel_off (struct gma_encoder *intel_encoder)
|
||||
{
|
||||
struct drm_device *dev = intel_encoder->base.dev;
|
||||
u32 pp, idle_off_mask = PP_ON ;
|
||||
@ -275,7 +275,7 @@ static void cdv_intel_edp_panel_off (struct psb_intel_encoder *intel_encoder)
|
||||
DRM_DEBUG_KMS("Over\n");
|
||||
}
|
||||
|
||||
static void cdv_intel_edp_backlight_on (struct psb_intel_encoder *intel_encoder)
|
||||
static void cdv_intel_edp_backlight_on (struct gma_encoder *intel_encoder)
|
||||
{
|
||||
struct drm_device *dev = intel_encoder->base.dev;
|
||||
u32 pp;
|
||||
@ -295,7 +295,7 @@ static void cdv_intel_edp_backlight_on (struct psb_intel_encoder *intel_encoder)
|
||||
gma_backlight_enable(dev);
|
||||
}
|
||||
|
||||
static void cdv_intel_edp_backlight_off (struct psb_intel_encoder *intel_encoder)
|
||||
static void cdv_intel_edp_backlight_off (struct gma_encoder *intel_encoder)
|
||||
{
|
||||
struct drm_device *dev = intel_encoder->base.dev;
|
||||
struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
|
||||
@ -315,7 +315,7 @@ static int
|
||||
cdv_intel_dp_mode_valid(struct drm_connector *connector,
|
||||
struct drm_display_mode *mode)
|
||||
{
|
||||
struct psb_intel_encoder *encoder = gma_attached_encoder(connector);
|
||||
struct gma_encoder *encoder = gma_attached_encoder(connector);
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
int max_link_clock = cdv_intel_dp_link_clock(cdv_intel_dp_max_link_bw(encoder));
|
||||
int max_lanes = cdv_intel_dp_max_lane_count(encoder);
|
||||
@ -371,7 +371,7 @@ unpack_aux(uint32_t src, uint8_t *dst, int dst_bytes)
|
||||
}
|
||||
|
||||
static int
|
||||
cdv_intel_dp_aux_ch(struct psb_intel_encoder *encoder,
|
||||
cdv_intel_dp_aux_ch(struct gma_encoder *encoder,
|
||||
uint8_t *send, int send_bytes,
|
||||
uint8_t *recv, int recv_size)
|
||||
{
|
||||
@ -473,7 +473,7 @@ cdv_intel_dp_aux_ch(struct psb_intel_encoder *encoder,
|
||||
|
||||
/* Write data to the aux channel in native mode */
|
||||
static int
|
||||
cdv_intel_dp_aux_native_write(struct psb_intel_encoder *encoder,
|
||||
cdv_intel_dp_aux_native_write(struct gma_encoder *encoder,
|
||||
uint16_t address, uint8_t *send, int send_bytes)
|
||||
{
|
||||
int ret;
|
||||
@ -505,7 +505,7 @@ cdv_intel_dp_aux_native_write(struct psb_intel_encoder *encoder,
|
||||
|
||||
/* Write a single byte to the aux channel in native mode */
|
||||
static int
|
||||
cdv_intel_dp_aux_native_write_1(struct psb_intel_encoder *encoder,
|
||||
cdv_intel_dp_aux_native_write_1(struct gma_encoder *encoder,
|
||||
uint16_t address, uint8_t byte)
|
||||
{
|
||||
return cdv_intel_dp_aux_native_write(encoder, address, &byte, 1);
|
||||
@ -513,7 +513,7 @@ cdv_intel_dp_aux_native_write_1(struct psb_intel_encoder *encoder,
|
||||
|
||||
/* read bytes from a native aux channel */
|
||||
static int
|
||||
cdv_intel_dp_aux_native_read(struct psb_intel_encoder *encoder,
|
||||
cdv_intel_dp_aux_native_read(struct gma_encoder *encoder,
|
||||
uint16_t address, uint8_t *recv, int recv_bytes)
|
||||
{
|
||||
uint8_t msg[4];
|
||||
@ -558,7 +558,7 @@ cdv_intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
|
||||
struct cdv_intel_dp *intel_dp = container_of(adapter,
|
||||
struct cdv_intel_dp,
|
||||
adapter);
|
||||
struct psb_intel_encoder *encoder = intel_dp->encoder;
|
||||
struct gma_encoder *encoder = intel_dp->encoder;
|
||||
uint16_t address = algo_data->address;
|
||||
uint8_t msg[5];
|
||||
uint8_t reply[2];
|
||||
@ -648,7 +648,8 @@ cdv_intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
|
||||
}
|
||||
|
||||
static int
|
||||
cdv_intel_dp_i2c_init(struct gma_connector *connector, struct psb_intel_encoder *encoder, const char *name)
|
||||
cdv_intel_dp_i2c_init(struct gma_connector *connector,
|
||||
struct gma_encoder *encoder, const char *name)
|
||||
{
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
int ret;
|
||||
@ -699,7 +700,7 @@ cdv_intel_dp_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mo
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct drm_psb_private *dev_priv = encoder->dev->dev_private;
|
||||
struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *intel_encoder = to_gma_encoder(encoder);
|
||||
struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
|
||||
int lane_count, clock;
|
||||
int max_lane_count = cdv_intel_dp_max_lane_count(intel_encoder);
|
||||
@ -802,13 +803,13 @@ cdv_intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
|
||||
* Find the lane count in the intel_encoder private
|
||||
*/
|
||||
list_for_each_entry(encoder, &mode_config->encoder_list, head) {
|
||||
struct psb_intel_encoder *intel_encoder;
|
||||
struct gma_encoder *intel_encoder;
|
||||
struct cdv_intel_dp *intel_dp;
|
||||
|
||||
if (encoder->crtc != crtc)
|
||||
continue;
|
||||
|
||||
intel_encoder = to_psb_intel_encoder(encoder);
|
||||
intel_encoder = to_gma_encoder(encoder);
|
||||
intel_dp = intel_encoder->dev_priv;
|
||||
if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT) {
|
||||
lane_count = intel_dp->lane_count;
|
||||
@ -842,7 +843,7 @@ static void
|
||||
cdv_intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *intel_encoder = to_gma_encoder(encoder);
|
||||
struct drm_crtc *crtc = encoder->crtc;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
|
||||
@ -909,7 +910,7 @@ cdv_intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode
|
||||
|
||||
|
||||
/* If the sink supports it, try to set the power state appropriately */
|
||||
static void cdv_intel_dp_sink_dpms(struct psb_intel_encoder *encoder, int mode)
|
||||
static void cdv_intel_dp_sink_dpms(struct gma_encoder *encoder, int mode)
|
||||
{
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
int ret, i;
|
||||
@ -941,7 +942,7 @@ static void cdv_intel_dp_sink_dpms(struct psb_intel_encoder *encoder, int mode)
|
||||
|
||||
static void cdv_intel_dp_prepare(struct drm_encoder *encoder)
|
||||
{
|
||||
struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *intel_encoder = to_gma_encoder(encoder);
|
||||
int edp = is_edp(intel_encoder);
|
||||
|
||||
if (edp) {
|
||||
@ -958,7 +959,7 @@ static void cdv_intel_dp_prepare(struct drm_encoder *encoder)
|
||||
|
||||
static void cdv_intel_dp_commit(struct drm_encoder *encoder)
|
||||
{
|
||||
struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *intel_encoder = to_gma_encoder(encoder);
|
||||
int edp = is_edp(intel_encoder);
|
||||
|
||||
if (edp)
|
||||
@ -972,7 +973,7 @@ static void cdv_intel_dp_commit(struct drm_encoder *encoder)
|
||||
static void
|
||||
cdv_intel_dp_dpms(struct drm_encoder *encoder, int mode)
|
||||
{
|
||||
struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *intel_encoder = to_gma_encoder(encoder);
|
||||
struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
|
||||
struct drm_device *dev = encoder->dev;
|
||||
uint32_t dp_reg = REG_READ(intel_dp->output_reg);
|
||||
@ -1007,7 +1008,7 @@ cdv_intel_dp_dpms(struct drm_encoder *encoder, int mode)
|
||||
* cases where the sink may still be asleep.
|
||||
*/
|
||||
static bool
|
||||
cdv_intel_dp_aux_native_read_retry(struct psb_intel_encoder *encoder, uint16_t address,
|
||||
cdv_intel_dp_aux_native_read_retry(struct gma_encoder *encoder, uint16_t address,
|
||||
uint8_t *recv, int recv_bytes)
|
||||
{
|
||||
int ret, i;
|
||||
@ -1032,7 +1033,7 @@ cdv_intel_dp_aux_native_read_retry(struct psb_intel_encoder *encoder, uint16_t a
|
||||
* link status information
|
||||
*/
|
||||
static bool
|
||||
cdv_intel_dp_get_link_status(struct psb_intel_encoder *encoder)
|
||||
cdv_intel_dp_get_link_status(struct gma_encoder *encoder)
|
||||
{
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
return cdv_intel_dp_aux_native_read_retry(encoder,
|
||||
@ -1106,7 +1107,7 @@ cdv_intel_dp_pre_emphasis_max(uint8_t voltage_swing)
|
||||
}
|
||||
*/
|
||||
static void
|
||||
cdv_intel_get_adjust_train(struct psb_intel_encoder *encoder)
|
||||
cdv_intel_get_adjust_train(struct gma_encoder *encoder)
|
||||
{
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
uint8_t v = 0;
|
||||
@ -1165,7 +1166,7 @@ cdv_intel_clock_recovery_ok(uint8_t link_status[DP_LINK_STATUS_SIZE], int lane_c
|
||||
DP_LANE_CHANNEL_EQ_DONE|\
|
||||
DP_LANE_SYMBOL_LOCKED)
|
||||
static bool
|
||||
cdv_intel_channel_eq_ok(struct psb_intel_encoder *encoder)
|
||||
cdv_intel_channel_eq_ok(struct gma_encoder *encoder)
|
||||
{
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
uint8_t lane_align;
|
||||
@ -1185,7 +1186,7 @@ cdv_intel_channel_eq_ok(struct psb_intel_encoder *encoder)
|
||||
}
|
||||
|
||||
static bool
|
||||
cdv_intel_dp_set_link_train(struct psb_intel_encoder *encoder,
|
||||
cdv_intel_dp_set_link_train(struct gma_encoder *encoder,
|
||||
uint32_t dp_reg_value,
|
||||
uint8_t dp_train_pat)
|
||||
{
|
||||
@ -1212,7 +1213,7 @@ cdv_intel_dp_set_link_train(struct psb_intel_encoder *encoder,
|
||||
|
||||
|
||||
static bool
|
||||
cdv_intel_dplink_set_level(struct psb_intel_encoder *encoder,
|
||||
cdv_intel_dplink_set_level(struct gma_encoder *encoder,
|
||||
uint8_t dp_train_pat)
|
||||
{
|
||||
|
||||
@ -1233,7 +1234,7 @@ cdv_intel_dplink_set_level(struct psb_intel_encoder *encoder,
|
||||
}
|
||||
|
||||
static void
|
||||
cdv_intel_dp_set_vswing_premph(struct psb_intel_encoder *encoder, uint8_t signal_level)
|
||||
cdv_intel_dp_set_vswing_premph(struct gma_encoder *encoder, uint8_t signal_level)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
@ -1299,7 +1300,7 @@ cdv_intel_dp_set_vswing_premph(struct psb_intel_encoder *encoder, uint8_t signal
|
||||
|
||||
/* Enable corresponding port and start training pattern 1 */
|
||||
static void
|
||||
cdv_intel_dp_start_link_train(struct psb_intel_encoder *encoder)
|
||||
cdv_intel_dp_start_link_train(struct gma_encoder *encoder)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
@ -1393,7 +1394,7 @@ cdv_intel_dp_start_link_train(struct psb_intel_encoder *encoder)
|
||||
}
|
||||
|
||||
static void
|
||||
cdv_intel_dp_complete_link_train(struct psb_intel_encoder *encoder)
|
||||
cdv_intel_dp_complete_link_train(struct gma_encoder *encoder)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
@ -1479,7 +1480,7 @@ cdv_intel_dp_complete_link_train(struct psb_intel_encoder *encoder)
|
||||
}
|
||||
|
||||
static void
|
||||
cdv_intel_dp_link_down(struct psb_intel_encoder *encoder)
|
||||
cdv_intel_dp_link_down(struct gma_encoder *encoder)
|
||||
{
|
||||
struct drm_device *dev = encoder->base.dev;
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
@ -1503,8 +1504,7 @@ cdv_intel_dp_link_down(struct psb_intel_encoder *encoder)
|
||||
REG_READ(intel_dp->output_reg);
|
||||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
cdv_dp_detect(struct psb_intel_encoder *encoder)
|
||||
static enum drm_connector_status cdv_dp_detect(struct gma_encoder *encoder)
|
||||
{
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
enum drm_connector_status status;
|
||||
@ -1532,7 +1532,7 @@ cdv_dp_detect(struct psb_intel_encoder *encoder)
|
||||
static enum drm_connector_status
|
||||
cdv_intel_dp_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct psb_intel_encoder *encoder = gma_attached_encoder(connector);
|
||||
struct gma_encoder *encoder = gma_attached_encoder(connector);
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
enum drm_connector_status status;
|
||||
struct edid *edid = NULL;
|
||||
@ -1566,8 +1566,7 @@ cdv_intel_dp_detect(struct drm_connector *connector, bool force)
|
||||
|
||||
static int cdv_intel_dp_get_modes(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *intel_encoder = gma_attached_encoder(connector);
|
||||
struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
|
||||
struct edid *edid = NULL;
|
||||
int ret = 0;
|
||||
@ -1623,7 +1622,7 @@ static int cdv_intel_dp_get_modes(struct drm_connector *connector)
|
||||
static bool
|
||||
cdv_intel_dp_detect_audio(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *encoder = gma_attached_encoder(connector);
|
||||
struct gma_encoder *encoder = gma_attached_encoder(connector);
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
struct edid *edid;
|
||||
bool has_audio = false;
|
||||
@ -1649,7 +1648,7 @@ cdv_intel_dp_set_property(struct drm_connector *connector,
|
||||
uint64_t val)
|
||||
{
|
||||
struct drm_psb_private *dev_priv = connector->dev->dev_private;
|
||||
struct psb_intel_encoder *encoder = gma_attached_encoder(connector);
|
||||
struct gma_encoder *encoder = gma_attached_encoder(connector);
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
int ret;
|
||||
|
||||
@ -1702,11 +1701,10 @@ done:
|
||||
static void
|
||||
cdv_intel_dp_destroy(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct cdv_intel_dp *intel_dp = psb_intel_encoder->dev_priv;
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct cdv_intel_dp *intel_dp = gma_encoder->dev_priv;
|
||||
|
||||
if (is_edp(psb_intel_encoder)) {
|
||||
if (is_edp(gma_encoder)) {
|
||||
/* cdv_intel_panel_destroy_backlight(connector->dev); */
|
||||
if (intel_dp->panel_fixed_mode) {
|
||||
kfree(intel_dp->panel_fixed_mode);
|
||||
@ -1802,7 +1800,7 @@ static void cdv_disable_intel_clock_gating(struct drm_device *dev)
|
||||
void
|
||||
cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev, int output_reg)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
@ -1810,8 +1808,8 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
|
||||
const char *name = NULL;
|
||||
int type = DRM_MODE_CONNECTOR_DisplayPort;
|
||||
|
||||
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL);
|
||||
if (!psb_intel_encoder)
|
||||
gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
|
||||
if (!gma_encoder)
|
||||
return;
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
|
||||
if (!gma_connector)
|
||||
@ -1824,21 +1822,21 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
|
||||
type = DRM_MODE_CONNECTOR_eDP;
|
||||
|
||||
connector = &gma_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
encoder = &gma_encoder->base;
|
||||
|
||||
drm_connector_init(dev, connector, &cdv_intel_dp_connector_funcs, type);
|
||||
drm_encoder_init(dev, encoder, &cdv_intel_dp_enc_funcs, DRM_MODE_ENCODER_TMDS);
|
||||
|
||||
gma_connector_attach_encoder(gma_connector, psb_intel_encoder);
|
||||
gma_connector_attach_encoder(gma_connector, gma_encoder);
|
||||
|
||||
if (type == DRM_MODE_CONNECTOR_DisplayPort)
|
||||
psb_intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
|
||||
gma_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
|
||||
else
|
||||
psb_intel_encoder->type = INTEL_OUTPUT_EDP;
|
||||
gma_encoder->type = INTEL_OUTPUT_EDP;
|
||||
|
||||
|
||||
psb_intel_encoder->dev_priv=intel_dp;
|
||||
intel_dp->encoder = psb_intel_encoder;
|
||||
gma_encoder->dev_priv=intel_dp;
|
||||
intel_dp->encoder = gma_encoder;
|
||||
intel_dp->output_reg = output_reg;
|
||||
|
||||
drm_encoder_helper_add(encoder, &cdv_intel_dp_helper_funcs);
|
||||
@ -1854,21 +1852,21 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
|
||||
switch (output_reg) {
|
||||
case DP_B:
|
||||
name = "DPDDC-B";
|
||||
psb_intel_encoder->ddi_select = (DP_MASK | DDI0_SELECT);
|
||||
gma_encoder->ddi_select = (DP_MASK | DDI0_SELECT);
|
||||
break;
|
||||
case DP_C:
|
||||
name = "DPDDC-C";
|
||||
psb_intel_encoder->ddi_select = (DP_MASK | DDI1_SELECT);
|
||||
gma_encoder->ddi_select = (DP_MASK | DDI1_SELECT);
|
||||
break;
|
||||
}
|
||||
|
||||
cdv_disable_intel_clock_gating(dev);
|
||||
|
||||
cdv_intel_dp_i2c_init(gma_connector, psb_intel_encoder, name);
|
||||
cdv_intel_dp_i2c_init(gma_connector, gma_encoder, name);
|
||||
/* FIXME:fail check */
|
||||
cdv_intel_dp_add_properties(connector);
|
||||
|
||||
if (is_edp(psb_intel_encoder)) {
|
||||
if (is_edp(gma_encoder)) {
|
||||
int ret;
|
||||
struct edp_power_seq cur;
|
||||
u32 pp_on, pp_off, pp_div;
|
||||
@ -1922,11 +1920,11 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
|
||||
intel_dp->backlight_on_delay, intel_dp->backlight_off_delay);
|
||||
|
||||
|
||||
cdv_intel_edp_panel_vdd_on(psb_intel_encoder);
|
||||
ret = cdv_intel_dp_aux_native_read(psb_intel_encoder, DP_DPCD_REV,
|
||||
cdv_intel_edp_panel_vdd_on(gma_encoder);
|
||||
ret = cdv_intel_dp_aux_native_read(gma_encoder, DP_DPCD_REV,
|
||||
intel_dp->dpcd,
|
||||
sizeof(intel_dp->dpcd));
|
||||
cdv_intel_edp_panel_vdd_off(psb_intel_encoder);
|
||||
cdv_intel_edp_panel_vdd_off(gma_encoder);
|
||||
if (ret == 0) {
|
||||
/* if this fails, presume the device is a ghost */
|
||||
DRM_INFO("failed to retrieve link info, disabling eDP\n");
|
||||
@ -1949,5 +1947,5 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
|
||||
err_priv:
|
||||
kfree(gma_connector);
|
||||
err_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
@ -64,8 +64,8 @@ static void cdv_hdmi_mode_set(struct drm_encoder *encoder,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct psb_intel_encoder *psb_intel_encoder = to_psb_intel_encoder(encoder);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
|
||||
struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
|
||||
u32 hdmib;
|
||||
struct drm_crtc *crtc = encoder->crtc;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
@ -99,9 +99,8 @@ static bool cdv_hdmi_mode_fixup(struct drm_encoder *encoder,
|
||||
static void cdv_hdmi_dpms(struct drm_encoder *encoder, int mode)
|
||||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
to_psb_intel_encoder(encoder);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
|
||||
struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
|
||||
u32 hdmib;
|
||||
|
||||
hdmib = REG_READ(hdmi_priv->hdmi_reg);
|
||||
@ -116,9 +115,8 @@ static void cdv_hdmi_dpms(struct drm_encoder *encoder, int mode)
|
||||
static void cdv_hdmi_save(struct drm_connector *connector)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
|
||||
|
||||
hdmi_priv->save_HDMIB = REG_READ(hdmi_priv->hdmi_reg);
|
||||
}
|
||||
@ -126,9 +124,8 @@ static void cdv_hdmi_save(struct drm_connector *connector)
|
||||
static void cdv_hdmi_restore(struct drm_connector *connector)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
|
||||
|
||||
REG_WRITE(hdmi_priv->hdmi_reg, hdmi_priv->save_HDMIB);
|
||||
REG_READ(hdmi_priv->hdmi_reg);
|
||||
@ -137,13 +134,12 @@ static void cdv_hdmi_restore(struct drm_connector *connector)
|
||||
static enum drm_connector_status cdv_hdmi_detect(
|
||||
struct drm_connector *connector, bool force)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
|
||||
struct edid *edid = NULL;
|
||||
enum drm_connector_status status = connector_status_disconnected;
|
||||
|
||||
edid = drm_get_edid(connector, &psb_intel_encoder->i2c_bus->adapter);
|
||||
edid = drm_get_edid(connector, &gma_encoder->i2c_bus->adapter);
|
||||
|
||||
hdmi_priv->has_hdmi_sink = false;
|
||||
hdmi_priv->has_hdmi_audio = false;
|
||||
@ -221,12 +217,11 @@ static int cdv_hdmi_set_property(struct drm_connector *connector,
|
||||
*/
|
||||
static int cdv_hdmi_get_modes(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct edid *edid = NULL;
|
||||
int ret = 0;
|
||||
|
||||
edid = drm_get_edid(connector, &psb_intel_encoder->i2c_bus->adapter);
|
||||
edid = drm_get_edid(connector, &gma_encoder->i2c_bus->adapter);
|
||||
if (edid) {
|
||||
drm_mode_connector_update_edid_property(connector, edid);
|
||||
ret = drm_add_edid_modes(connector, edid);
|
||||
@ -256,11 +251,10 @@ static int cdv_hdmi_mode_valid(struct drm_connector *connector,
|
||||
|
||||
static void cdv_hdmi_destroy(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
|
||||
if (psb_intel_encoder->i2c_bus)
|
||||
psb_intel_i2c_destroy(psb_intel_encoder->i2c_bus);
|
||||
if (gma_encoder->i2c_bus)
|
||||
psb_intel_i2c_destroy(gma_encoder->i2c_bus);
|
||||
drm_sysfs_connector_remove(connector);
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(connector);
|
||||
@ -294,17 +288,16 @@ static const struct drm_connector_funcs cdv_hdmi_connector_funcs = {
|
||||
void cdv_hdmi_init(struct drm_device *dev,
|
||||
struct psb_intel_mode_device *mode_dev, int reg)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
struct mid_intel_hdmi_priv *hdmi_priv;
|
||||
int ddc_bus;
|
||||
|
||||
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder),
|
||||
GFP_KERNEL);
|
||||
gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
|
||||
|
||||
if (!psb_intel_encoder)
|
||||
if (!gma_encoder)
|
||||
return;
|
||||
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector),
|
||||
@ -320,7 +313,7 @@ void cdv_hdmi_init(struct drm_device *dev,
|
||||
|
||||
connector = &gma_connector->base;
|
||||
connector->polled = DRM_CONNECTOR_POLL_HPD;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
encoder = &gma_encoder->base;
|
||||
drm_connector_init(dev, connector,
|
||||
&cdv_hdmi_connector_funcs,
|
||||
DRM_MODE_CONNECTOR_DVID);
|
||||
@ -328,11 +321,11 @@ void cdv_hdmi_init(struct drm_device *dev,
|
||||
drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
|
||||
DRM_MODE_ENCODER_TMDS);
|
||||
|
||||
gma_connector_attach_encoder(gma_connector, psb_intel_encoder);
|
||||
psb_intel_encoder->type = INTEL_OUTPUT_HDMI;
|
||||
gma_connector_attach_encoder(gma_connector, gma_encoder);
|
||||
gma_encoder->type = INTEL_OUTPUT_HDMI;
|
||||
hdmi_priv->hdmi_reg = reg;
|
||||
hdmi_priv->has_hdmi_sink = false;
|
||||
psb_intel_encoder->dev_priv = hdmi_priv;
|
||||
gma_encoder->dev_priv = hdmi_priv;
|
||||
|
||||
drm_encoder_helper_add(encoder, &cdv_hdmi_helper_funcs);
|
||||
drm_connector_helper_add(connector,
|
||||
@ -348,11 +341,11 @@ void cdv_hdmi_init(struct drm_device *dev,
|
||||
switch (reg) {
|
||||
case SDVOB:
|
||||
ddc_bus = GPIOE;
|
||||
psb_intel_encoder->ddi_select = DDI0_SELECT;
|
||||
gma_encoder->ddi_select = DDI0_SELECT;
|
||||
break;
|
||||
case SDVOC:
|
||||
ddc_bus = GPIOD;
|
||||
psb_intel_encoder->ddi_select = DDI1_SELECT;
|
||||
gma_encoder->ddi_select = DDI1_SELECT;
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("unknown reg 0x%x for HDMI\n", reg);
|
||||
@ -360,16 +353,15 @@ void cdv_hdmi_init(struct drm_device *dev,
|
||||
break;
|
||||
}
|
||||
|
||||
psb_intel_encoder->i2c_bus = psb_intel_i2c_create(dev,
|
||||
gma_encoder->i2c_bus = psb_intel_i2c_create(dev,
|
||||
ddc_bus, (reg == SDVOB) ? "HDMIB" : "HDMIC");
|
||||
|
||||
if (!psb_intel_encoder->i2c_bus) {
|
||||
if (!gma_encoder->i2c_bus) {
|
||||
dev_err(dev->dev, "No ddc adapter available!\n");
|
||||
goto failed_ddc;
|
||||
}
|
||||
|
||||
hdmi_priv->hdmi_i2c_adapter =
|
||||
&(psb_intel_encoder->i2c_bus->adapter);
|
||||
hdmi_priv->hdmi_i2c_adapter = &(gma_encoder->i2c_bus->adapter);
|
||||
hdmi_priv->dev = dev;
|
||||
drm_sysfs_connector_add(connector);
|
||||
return;
|
||||
@ -380,5 +372,5 @@ failed_ddc:
|
||||
err_priv:
|
||||
kfree(gma_connector);
|
||||
err_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
@ -406,12 +406,11 @@ static int cdv_intel_lvds_get_modes(struct drm_connector *connector)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
|
||||
int ret;
|
||||
|
||||
ret = psb_intel_ddc_get_modes(connector, &psb_intel_encoder->i2c_bus->adapter);
|
||||
ret = psb_intel_ddc_get_modes(connector, &gma_encoder->i2c_bus->adapter);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -443,11 +442,10 @@ static int cdv_intel_lvds_get_modes(struct drm_connector *connector)
|
||||
*/
|
||||
static void cdv_intel_lvds_destroy(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
|
||||
if (psb_intel_encoder->i2c_bus)
|
||||
psb_intel_i2c_destroy(psb_intel_encoder->i2c_bus);
|
||||
if (gma_encoder->i2c_bus)
|
||||
psb_intel_i2c_destroy(gma_encoder->i2c_bus);
|
||||
drm_sysfs_connector_remove(connector);
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(connector);
|
||||
@ -610,7 +608,7 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
|
||||
void cdv_intel_lvds_init(struct drm_device *dev,
|
||||
struct psb_intel_mode_device *mode_dev)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct cdv_intel_lvds_priv *lvds_priv;
|
||||
struct drm_connector *connector;
|
||||
@ -628,9 +626,9 @@ void cdv_intel_lvds_init(struct drm_device *dev,
|
||||
return;
|
||||
}
|
||||
|
||||
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder),
|
||||
gma_encoder = kzalloc(sizeof(struct gma_encoder),
|
||||
GFP_KERNEL);
|
||||
if (!psb_intel_encoder)
|
||||
if (!gma_encoder)
|
||||
return;
|
||||
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector),
|
||||
@ -642,10 +640,10 @@ void cdv_intel_lvds_init(struct drm_device *dev,
|
||||
if (!lvds_priv)
|
||||
goto failed_lvds_priv;
|
||||
|
||||
psb_intel_encoder->dev_priv = lvds_priv;
|
||||
gma_encoder->dev_priv = lvds_priv;
|
||||
|
||||
connector = &gma_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
encoder = &gma_encoder->base;
|
||||
|
||||
|
||||
drm_connector_init(dev, connector,
|
||||
@ -657,8 +655,8 @@ void cdv_intel_lvds_init(struct drm_device *dev,
|
||||
DRM_MODE_ENCODER_LVDS);
|
||||
|
||||
|
||||
gma_connector_attach_encoder(gma_connector, psb_intel_encoder);
|
||||
psb_intel_encoder->type = INTEL_OUTPUT_LVDS;
|
||||
gma_connector_attach_encoder(gma_connector, gma_encoder);
|
||||
gma_encoder->type = INTEL_OUTPUT_LVDS;
|
||||
|
||||
drm_encoder_helper_add(encoder, &cdv_intel_lvds_helper_funcs);
|
||||
drm_connector_helper_add(connector,
|
||||
@ -679,16 +677,16 @@ void cdv_intel_lvds_init(struct drm_device *dev,
|
||||
* Set up I2C bus
|
||||
* FIXME: distroy i2c_bus when exit
|
||||
*/
|
||||
psb_intel_encoder->i2c_bus = psb_intel_i2c_create(dev,
|
||||
gma_encoder->i2c_bus = psb_intel_i2c_create(dev,
|
||||
GPIOB,
|
||||
"LVDSBLC_B");
|
||||
if (!psb_intel_encoder->i2c_bus) {
|
||||
if (!gma_encoder->i2c_bus) {
|
||||
dev_printk(KERN_ERR,
|
||||
&dev->pdev->dev, "I2C bus registration failed.\n");
|
||||
goto failed_blc_i2c;
|
||||
}
|
||||
psb_intel_encoder->i2c_bus->slave_addr = 0x2C;
|
||||
dev_priv->lvds_i2c_bus = psb_intel_encoder->i2c_bus;
|
||||
gma_encoder->i2c_bus->slave_addr = 0x2C;
|
||||
dev_priv->lvds_i2c_bus = gma_encoder->i2c_bus;
|
||||
|
||||
/*
|
||||
* LVDS discovery:
|
||||
@ -701,10 +699,10 @@ void cdv_intel_lvds_init(struct drm_device *dev,
|
||||
*/
|
||||
|
||||
/* Set up the DDC bus. */
|
||||
psb_intel_encoder->ddc_bus = psb_intel_i2c_create(dev,
|
||||
gma_encoder->ddc_bus = psb_intel_i2c_create(dev,
|
||||
GPIOC,
|
||||
"LVDSDDC_C");
|
||||
if (!psb_intel_encoder->ddc_bus) {
|
||||
if (!gma_encoder->ddc_bus) {
|
||||
dev_printk(KERN_ERR, &dev->pdev->dev,
|
||||
"DDC bus registration " "failed.\n");
|
||||
goto failed_ddc;
|
||||
@ -715,7 +713,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
|
||||
* preferred mode is the right one.
|
||||
*/
|
||||
psb_intel_ddc_get_modes(connector,
|
||||
&psb_intel_encoder->ddc_bus->adapter);
|
||||
&gma_encoder->ddc_bus->adapter);
|
||||
list_for_each_entry(scan, &connector->probed_modes, head) {
|
||||
if (scan->type & DRM_MODE_TYPE_PREFERRED) {
|
||||
mode_dev->panel_fixed_mode =
|
||||
@ -779,12 +777,12 @@ out:
|
||||
|
||||
failed_find:
|
||||
printk(KERN_ERR "Failed find\n");
|
||||
if (psb_intel_encoder->ddc_bus)
|
||||
psb_intel_i2c_destroy(psb_intel_encoder->ddc_bus);
|
||||
if (gma_encoder->ddc_bus)
|
||||
psb_intel_i2c_destroy(gma_encoder->ddc_bus);
|
||||
failed_ddc:
|
||||
printk(KERN_ERR "Failed DDC\n");
|
||||
if (psb_intel_encoder->i2c_bus)
|
||||
psb_intel_i2c_destroy(psb_intel_encoder->i2c_bus);
|
||||
if (gma_encoder->i2c_bus)
|
||||
psb_intel_i2c_destroy(gma_encoder->i2c_bus);
|
||||
failed_blc_i2c:
|
||||
printk(KERN_ERR "Failed BLC\n");
|
||||
drm_encoder_cleanup(encoder);
|
||||
@ -793,5 +791,5 @@ failed_blc_i2c:
|
||||
failed_lvds_priv:
|
||||
kfree(gma_connector);
|
||||
failed_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
@ -703,13 +703,12 @@ static void psb_setup_outputs(struct drm_device *dev)
|
||||
|
||||
list_for_each_entry(connector, &dev->mode_config.connector_list,
|
||||
head) {
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct drm_encoder *encoder = &psb_intel_encoder->base;
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct drm_encoder *encoder = &gma_encoder->base;
|
||||
int crtc_mask = 0, clone_mask = 0;
|
||||
|
||||
/* valid crtcs */
|
||||
switch (psb_intel_encoder->type) {
|
||||
switch (gma_encoder->type) {
|
||||
case INTEL_OUTPUT_ANALOG:
|
||||
crtc_mask = (1 << 0);
|
||||
clone_mask = (1 << INTEL_OUTPUT_ANALOG);
|
||||
|
@ -37,9 +37,9 @@ bool gma_pipe_has_type(struct drm_crtc *crtc, int type)
|
||||
|
||||
list_for_each_entry(l_entry, &mode_config->connector_list, head) {
|
||||
if (l_entry->encoder && l_entry->encoder->crtc == crtc) {
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
struct gma_encoder *gma_encoder =
|
||||
gma_attached_encoder(l_entry);
|
||||
if (psb_intel_encoder->type == type)
|
||||
if (gma_encoder->type == type)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -657,7 +657,7 @@ void gma_encoder_commit(struct drm_encoder *encoder)
|
||||
|
||||
void gma_encoder_destroy(struct drm_encoder *encoder)
|
||||
{
|
||||
struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *intel_encoder = to_gma_encoder(encoder);
|
||||
|
||||
drm_encoder_cleanup(encoder);
|
||||
kfree(intel_encoder);
|
||||
@ -666,14 +666,13 @@ void gma_encoder_destroy(struct drm_encoder *encoder)
|
||||
/* Currently there is only a 1:1 mapping of encoders and connectors */
|
||||
struct drm_encoder *gma_best_encoder(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
|
||||
return &psb_intel_encoder->base;
|
||||
return &gma_encoder->base;
|
||||
}
|
||||
|
||||
void gma_connector_attach_encoder(struct gma_connector *connector,
|
||||
struct psb_intel_encoder *encoder)
|
||||
struct gma_encoder *encoder)
|
||||
{
|
||||
connector->encoder = encoder;
|
||||
drm_mode_connector_attach_encoder(&connector->base,
|
||||
|
@ -238,7 +238,7 @@ struct mdfld_dsi_connector {
|
||||
};
|
||||
|
||||
struct mdfld_dsi_encoder {
|
||||
struct psb_intel_encoder base;
|
||||
struct gma_encoder base;
|
||||
void *private;
|
||||
};
|
||||
|
||||
@ -279,11 +279,11 @@ static inline struct mdfld_dsi_connector *mdfld_dsi_connector(
|
||||
static inline struct mdfld_dsi_encoder *mdfld_dsi_encoder(
|
||||
struct drm_encoder *encoder)
|
||||
{
|
||||
struct psb_intel_encoder *psb_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
|
||||
psb_encoder = to_psb_intel_encoder(encoder);
|
||||
gma_encoder = to_gma_encoder(encoder);
|
||||
|
||||
return container_of(psb_encoder, struct mdfld_dsi_encoder, base);
|
||||
return container_of(gma_encoder, struct mdfld_dsi_encoder, base);
|
||||
}
|
||||
|
||||
static inline struct mdfld_dsi_config *
|
||||
|
@ -681,7 +681,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
|
||||
u32 dpll = 0, fp = 0;
|
||||
bool is_mipi = false, is_mipi2 = false, is_hdmi = false;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct psb_intel_encoder *psb_intel_encoder = NULL;
|
||||
struct gma_encoder *gma_encoder = NULL;
|
||||
uint64_t scalingType = DRM_MODE_SCALE_FULLSCREEN;
|
||||
struct drm_encoder *encoder;
|
||||
struct drm_connector *connector;
|
||||
@ -747,9 +747,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
|
||||
if (encoder->crtc != crtc)
|
||||
continue;
|
||||
|
||||
psb_intel_encoder = gma_attached_encoder(connector);
|
||||
gma_encoder = gma_attached_encoder(connector);
|
||||
|
||||
switch (psb_intel_encoder->type) {
|
||||
switch (gma_encoder->type) {
|
||||
case INTEL_OUTPUT_MIPI:
|
||||
is_mipi = true;
|
||||
break;
|
||||
@ -800,7 +800,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
|
||||
|
||||
REG_WRITE(map->pos, 0);
|
||||
|
||||
if (psb_intel_encoder)
|
||||
if (gma_encoder)
|
||||
drm_object_property_get_value(&connector->base,
|
||||
dev->mode_config.scaling_mode_property, &scalingType);
|
||||
|
||||
|
@ -303,7 +303,7 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
|
||||
bool is_lvds = false;
|
||||
bool is_mipi = false;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct psb_intel_encoder *psb_intel_encoder = NULL;
|
||||
struct gma_encoder *gma_encoder = NULL;
|
||||
uint64_t scalingType = DRM_MODE_SCALE_FULLSCREEN;
|
||||
struct drm_connector *connector;
|
||||
|
||||
@ -324,9 +324,9 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
|
||||
if (!connector->encoder || connector->encoder->crtc != crtc)
|
||||
continue;
|
||||
|
||||
psb_intel_encoder = gma_attached_encoder(connector);
|
||||
gma_encoder = gma_attached_encoder(connector);
|
||||
|
||||
switch (psb_intel_encoder->type) {
|
||||
switch (gma_encoder->type) {
|
||||
case INTEL_OUTPUT_LVDS:
|
||||
is_lvds = true;
|
||||
break;
|
||||
@ -350,7 +350,7 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
|
||||
((mode->crtc_hdisplay - 1) << 16) |
|
||||
(mode->crtc_vdisplay - 1));
|
||||
|
||||
if (psb_intel_encoder)
|
||||
if (gma_encoder)
|
||||
drm_object_property_get_value(&connector->base,
|
||||
dev->mode_config.scaling_mode_property, &scalingType);
|
||||
|
||||
|
@ -640,13 +640,13 @@ static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = {
|
||||
void oaktrail_hdmi_init(struct drm_device *dev,
|
||||
struct psb_intel_mode_device *mode_dev)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
|
||||
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL);
|
||||
if (!psb_intel_encoder)
|
||||
gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
|
||||
if (!gma_encoder)
|
||||
return;
|
||||
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
|
||||
@ -654,7 +654,7 @@ void oaktrail_hdmi_init(struct drm_device *dev,
|
||||
goto failed_connector;
|
||||
|
||||
connector = &gma_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
encoder = &gma_encoder->base;
|
||||
drm_connector_init(dev, connector,
|
||||
&oaktrail_hdmi_connector_funcs,
|
||||
DRM_MODE_CONNECTOR_DVID);
|
||||
@ -663,9 +663,9 @@ void oaktrail_hdmi_init(struct drm_device *dev,
|
||||
&oaktrail_hdmi_enc_funcs,
|
||||
DRM_MODE_ENCODER_TMDS);
|
||||
|
||||
gma_connector_attach_encoder(gma_connector, psb_intel_encoder);
|
||||
gma_connector_attach_encoder(gma_connector, gma_encoder);
|
||||
|
||||
psb_intel_encoder->type = INTEL_OUTPUT_HDMI;
|
||||
gma_encoder->type = INTEL_OUTPUT_HDMI;
|
||||
drm_encoder_helper_add(encoder, &oaktrail_hdmi_helper_funcs);
|
||||
drm_connector_helper_add(connector, &oaktrail_hdmi_connector_helper_funcs);
|
||||
|
||||
@ -678,7 +678,7 @@ void oaktrail_hdmi_init(struct drm_device *dev,
|
||||
return;
|
||||
|
||||
failed_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
||||
static DEFINE_PCI_DEVICE_TABLE(hdmi_ids) = {
|
||||
|
@ -43,7 +43,7 @@
|
||||
* Sets the power state for the panel.
|
||||
*/
|
||||
static void oaktrail_lvds_set_power(struct drm_device *dev,
|
||||
struct psb_intel_encoder *psb_intel_encoder,
|
||||
struct gma_encoder *gma_encoder,
|
||||
bool on)
|
||||
{
|
||||
u32 pp_status;
|
||||
@ -78,13 +78,12 @@ static void oaktrail_lvds_set_power(struct drm_device *dev,
|
||||
static void oaktrail_lvds_dpms(struct drm_encoder *encoder, int mode)
|
||||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
|
||||
|
||||
if (mode == DRM_MODE_DPMS_ON)
|
||||
oaktrail_lvds_set_power(dev, psb_intel_encoder, true);
|
||||
oaktrail_lvds_set_power(dev, gma_encoder, true);
|
||||
else
|
||||
oaktrail_lvds_set_power(dev, psb_intel_encoder, false);
|
||||
oaktrail_lvds_set_power(dev, gma_encoder, false);
|
||||
|
||||
/* XXX: We never power down the LVDS pairs. */
|
||||
}
|
||||
@ -166,8 +165,7 @@ static void oaktrail_lvds_prepare(struct drm_encoder *encoder)
|
||||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
|
||||
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
|
||||
|
||||
if (!gma_power_begin(dev, true))
|
||||
@ -176,7 +174,7 @@ static void oaktrail_lvds_prepare(struct drm_encoder *encoder)
|
||||
mode_dev->saveBLC_PWM_CTL = REG_READ(BLC_PWM_CTL);
|
||||
mode_dev->backlight_duty_cycle = (mode_dev->saveBLC_PWM_CTL &
|
||||
BACKLIGHT_DUTY_CYCLE_MASK);
|
||||
oaktrail_lvds_set_power(dev, psb_intel_encoder, false);
|
||||
oaktrail_lvds_set_power(dev, gma_encoder, false);
|
||||
gma_power_end(dev);
|
||||
}
|
||||
|
||||
@ -203,14 +201,13 @@ static void oaktrail_lvds_commit(struct drm_encoder *encoder)
|
||||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
|
||||
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
|
||||
|
||||
if (mode_dev->backlight_duty_cycle == 0)
|
||||
mode_dev->backlight_duty_cycle =
|
||||
oaktrail_lvds_get_max_backlight(dev);
|
||||
oaktrail_lvds_set_power(dev, psb_intel_encoder, true);
|
||||
oaktrail_lvds_set_power(dev, gma_encoder, true);
|
||||
}
|
||||
|
||||
static const struct drm_encoder_helper_funcs oaktrail_lvds_helper_funcs = {
|
||||
@ -325,7 +322,7 @@ static void oaktrail_lvds_get_configuration_mode(struct drm_device *dev,
|
||||
void oaktrail_lvds_init(struct drm_device *dev,
|
||||
struct psb_intel_mode_device *mode_dev)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
@ -334,8 +331,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
|
||||
struct i2c_adapter *i2c_adap;
|
||||
struct drm_display_mode *scan; /* *modes, *bios_mode; */
|
||||
|
||||
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL);
|
||||
if (!psb_intel_encoder)
|
||||
gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
|
||||
if (!gma_encoder)
|
||||
return;
|
||||
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
|
||||
@ -343,7 +340,7 @@ void oaktrail_lvds_init(struct drm_device *dev,
|
||||
goto failed_connector;
|
||||
|
||||
connector = &gma_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
encoder = &gma_encoder->base;
|
||||
dev_priv->is_lvds_on = true;
|
||||
drm_connector_init(dev, connector,
|
||||
&psb_intel_lvds_connector_funcs,
|
||||
@ -352,8 +349,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
|
||||
drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
|
||||
DRM_MODE_ENCODER_LVDS);
|
||||
|
||||
gma_connector_attach_encoder(gma_connector, psb_intel_encoder);
|
||||
psb_intel_encoder->type = INTEL_OUTPUT_LVDS;
|
||||
gma_connector_attach_encoder(gma_connector, gma_encoder);
|
||||
gma_encoder->type = INTEL_OUTPUT_LVDS;
|
||||
|
||||
drm_encoder_helper_add(encoder, &oaktrail_lvds_helper_funcs);
|
||||
drm_connector_helper_add(connector,
|
||||
@ -433,8 +430,8 @@ out:
|
||||
|
||||
failed_find:
|
||||
dev_dbg(dev->dev, "No LVDS modes found, disabling.\n");
|
||||
if (psb_intel_encoder->ddc_bus)
|
||||
psb_intel_i2c_destroy(psb_intel_encoder->ddc_bus);
|
||||
if (gma_encoder->ddc_bus)
|
||||
psb_intel_i2c_destroy(gma_encoder->ddc_bus);
|
||||
|
||||
/* failed_ddc: */
|
||||
|
||||
@ -442,6 +439,6 @@ failed_find:
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(gma_connector);
|
||||
failed_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
|
||||
unsigned long irqflags;
|
||||
int ret = -ENOMEM;
|
||||
struct drm_connector *connector;
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
|
||||
dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
|
||||
if (dev_priv == NULL)
|
||||
@ -372,9 +372,9 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
|
||||
/* Only add backlight support if we have LVDS output */
|
||||
list_for_each_entry(connector, &dev->mode_config.connector_list,
|
||||
head) {
|
||||
psb_intel_encoder = gma_attached_encoder(connector);
|
||||
gma_encoder = gma_attached_encoder(connector);
|
||||
|
||||
switch (psb_intel_encoder->type) {
|
||||
switch (gma_encoder->type) {
|
||||
case INTEL_OUTPUT_LVDS:
|
||||
case INTEL_OUTPUT_MIPI:
|
||||
ret = gma_backlight_init(dev);
|
||||
|
@ -126,14 +126,13 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
|
||||
}
|
||||
|
||||
list_for_each_entry(connector, &mode_config->connector_list, head) {
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
|
||||
if (!connector->encoder
|
||||
|| connector->encoder->crtc != crtc)
|
||||
continue;
|
||||
|
||||
switch (psb_intel_encoder->type) {
|
||||
switch (gma_encoder->type) {
|
||||
case INTEL_OUTPUT_LVDS:
|
||||
is_lvds = true;
|
||||
break;
|
||||
@ -602,9 +601,8 @@ int gma_connector_clones(struct drm_device *dev, int type_mask)
|
||||
|
||||
list_for_each_entry(connector, &dev->mode_config.connector_list,
|
||||
head) {
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
if (type_mask & (1 << psb_intel_encoder->type))
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
if (type_mask & (1 << gma_encoder->type))
|
||||
index_mask |= (1 << entry);
|
||||
entry++;
|
||||
}
|
||||
|
@ -117,11 +117,11 @@ struct psb_intel_i2c_chan {
|
||||
u8 slave_addr;
|
||||
};
|
||||
|
||||
struct psb_intel_encoder {
|
||||
struct gma_encoder {
|
||||
struct drm_encoder base;
|
||||
int type;
|
||||
bool needs_tv_clock;
|
||||
void (*hot_plug)(struct psb_intel_encoder *);
|
||||
void (*hot_plug)(struct gma_encoder *);
|
||||
int crtc_mask;
|
||||
int clone_mask;
|
||||
u32 ddi_select; /* Channel info */
|
||||
@ -139,7 +139,7 @@ struct psb_intel_encoder {
|
||||
|
||||
struct gma_connector {
|
||||
struct drm_connector base;
|
||||
struct psb_intel_encoder *encoder;
|
||||
struct gma_encoder *encoder;
|
||||
};
|
||||
|
||||
struct psb_intel_crtc_state {
|
||||
@ -197,8 +197,8 @@ struct gma_crtc {
|
||||
container_of(x, struct gma_crtc, base)
|
||||
#define to_gma_connector(x) \
|
||||
container_of(x, struct gma_connector, base)
|
||||
#define to_psb_intel_encoder(x) \
|
||||
container_of(x, struct psb_intel_encoder, base)
|
||||
#define to_gma_encoder(x) \
|
||||
container_of(x, struct gma_encoder, base)
|
||||
#define to_psb_intel_framebuffer(x) \
|
||||
container_of(x, struct psb_intel_framebuffer, base)
|
||||
|
||||
@ -228,9 +228,9 @@ extern void mid_dsi_init(struct drm_device *dev,
|
||||
|
||||
extern struct drm_encoder *gma_best_encoder(struct drm_connector *connector);
|
||||
extern void gma_connector_attach_encoder(struct gma_connector *connector,
|
||||
struct psb_intel_encoder *encoder);
|
||||
struct gma_encoder *encoder);
|
||||
|
||||
static inline struct psb_intel_encoder *gma_attached_encoder(
|
||||
static inline struct gma_encoder *gma_attached_encoder(
|
||||
struct drm_connector *connector)
|
||||
{
|
||||
return to_gma_connector(connector)->encoder;
|
||||
|
@ -267,10 +267,9 @@ static void psb_intel_lvds_save(struct drm_connector *connector)
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_psb_private *dev_priv =
|
||||
(struct drm_psb_private *)dev->dev_private;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct psb_intel_lvds_priv *lvds_priv =
|
||||
(struct psb_intel_lvds_priv *)psb_intel_encoder->dev_priv;
|
||||
(struct psb_intel_lvds_priv *)gma_encoder->dev_priv;
|
||||
|
||||
lvds_priv->savePP_ON = REG_READ(LVDSPP_ON);
|
||||
lvds_priv->savePP_OFF = REG_READ(LVDSPP_OFF);
|
||||
@ -307,10 +306,9 @@ static void psb_intel_lvds_restore(struct drm_connector *connector)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
u32 pp_status;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct psb_intel_lvds_priv *lvds_priv =
|
||||
(struct psb_intel_lvds_priv *)psb_intel_encoder->dev_priv;
|
||||
(struct psb_intel_lvds_priv *)gma_encoder->dev_priv;
|
||||
|
||||
dev_dbg(dev->dev, "(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
|
||||
lvds_priv->savePP_ON,
|
||||
@ -349,12 +347,11 @@ int psb_intel_lvds_mode_valid(struct drm_connector *connector,
|
||||
struct drm_display_mode *mode)
|
||||
{
|
||||
struct drm_psb_private *dev_priv = connector->dev->dev_private;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct drm_display_mode *fixed_mode =
|
||||
dev_priv->mode_dev.panel_fixed_mode;
|
||||
|
||||
if (psb_intel_encoder->type == INTEL_OUTPUT_MIPI2)
|
||||
if (gma_encoder->type == INTEL_OUTPUT_MIPI2)
|
||||
fixed_mode = dev_priv->mode_dev.panel_fixed_mode2;
|
||||
|
||||
/* just in case */
|
||||
@ -384,10 +381,9 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc);
|
||||
struct drm_encoder *tmp_encoder;
|
||||
struct drm_display_mode *panel_fixed_mode = mode_dev->panel_fixed_mode;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
to_psb_intel_encoder(encoder);
|
||||
struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
|
||||
|
||||
if (psb_intel_encoder->type == INTEL_OUTPUT_MIPI2)
|
||||
if (gma_encoder->type == INTEL_OUTPUT_MIPI2)
|
||||
panel_fixed_mode = mode_dev->panel_fixed_mode2;
|
||||
|
||||
/* PSB requires the LVDS is on pipe B, MRST has only one pipe anyway */
|
||||
@ -524,9 +520,8 @@ static int psb_intel_lvds_get_modes(struct drm_connector *connector)
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct psb_intel_lvds_priv *lvds_priv = psb_intel_encoder->dev_priv;
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv;
|
||||
int ret = 0;
|
||||
|
||||
if (!IS_MRST(dev))
|
||||
@ -563,9 +558,8 @@ static int psb_intel_lvds_get_modes(struct drm_connector *connector)
|
||||
*/
|
||||
void psb_intel_lvds_destroy(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct psb_intel_lvds_priv *lvds_priv = psb_intel_encoder->dev_priv;
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv;
|
||||
|
||||
if (lvds_priv->ddc_bus)
|
||||
psb_intel_i2c_destroy(lvds_priv->ddc_bus);
|
||||
@ -689,7 +683,7 @@ const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = {
|
||||
void psb_intel_lvds_init(struct drm_device *dev,
|
||||
struct psb_intel_mode_device *mode_dev)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct psb_intel_lvds_priv *lvds_priv;
|
||||
struct drm_connector *connector;
|
||||
@ -700,10 +694,9 @@ void psb_intel_lvds_init(struct drm_device *dev,
|
||||
u32 lvds;
|
||||
int pipe;
|
||||
|
||||
psb_intel_encoder =
|
||||
kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL);
|
||||
if (!psb_intel_encoder) {
|
||||
dev_err(dev->dev, "psb_intel_encoder allocation error\n");
|
||||
gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
|
||||
if (!gma_encoder) {
|
||||
dev_err(dev->dev, "gma_encoder allocation error\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -719,10 +712,10 @@ void psb_intel_lvds_init(struct drm_device *dev,
|
||||
goto failed_connector;
|
||||
}
|
||||
|
||||
psb_intel_encoder->dev_priv = lvds_priv;
|
||||
gma_encoder->dev_priv = lvds_priv;
|
||||
|
||||
connector = &gma_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
encoder = &gma_encoder->base;
|
||||
drm_connector_init(dev, connector,
|
||||
&psb_intel_lvds_connector_funcs,
|
||||
DRM_MODE_CONNECTOR_LVDS);
|
||||
@ -731,8 +724,8 @@ void psb_intel_lvds_init(struct drm_device *dev,
|
||||
&psb_intel_lvds_enc_funcs,
|
||||
DRM_MODE_ENCODER_LVDS);
|
||||
|
||||
gma_connector_attach_encoder(gma_connector, psb_intel_encoder);
|
||||
psb_intel_encoder->type = INTEL_OUTPUT_LVDS;
|
||||
gma_connector_attach_encoder(gma_connector, gma_encoder);
|
||||
gma_encoder->type = INTEL_OUTPUT_LVDS;
|
||||
|
||||
drm_encoder_helper_add(encoder, &psb_intel_lvds_helper_funcs);
|
||||
drm_connector_helper_add(connector,
|
||||
@ -849,6 +842,6 @@ failed_blc_i2c:
|
||||
failed_connector:
|
||||
kfree(gma_connector);
|
||||
failed_encoder:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ static const char *tv_format_names[] = {
|
||||
#define TV_FORMAT_NUM (sizeof(tv_format_names) / sizeof(*tv_format_names))
|
||||
|
||||
struct psb_intel_sdvo {
|
||||
struct psb_intel_encoder base;
|
||||
struct gma_encoder base;
|
||||
|
||||
struct i2c_adapter *i2c;
|
||||
u8 slave_addr;
|
||||
@ -1836,10 +1836,8 @@ done:
|
||||
static void psb_intel_sdvo_save(struct drm_connector *connector)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
gma_attached_encoder(connector);
|
||||
struct psb_intel_sdvo *sdvo =
|
||||
to_psb_intel_sdvo(&psb_intel_encoder->base);
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
struct psb_intel_sdvo *sdvo = to_psb_intel_sdvo(&gma_encoder->base);
|
||||
|
||||
sdvo->saveSDVO = REG_READ(sdvo->sdvo_reg);
|
||||
}
|
||||
@ -2539,7 +2537,7 @@ psb_intel_sdvo_init_ddc_proxy(struct psb_intel_sdvo *sdvo,
|
||||
bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
|
||||
{
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct psb_intel_sdvo *psb_intel_sdvo;
|
||||
int i;
|
||||
|
||||
@ -2556,9 +2554,9 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
|
||||
}
|
||||
|
||||
/* encoder type will be decided later */
|
||||
psb_intel_encoder = &psb_intel_sdvo->base;
|
||||
psb_intel_encoder->type = INTEL_OUTPUT_SDVO;
|
||||
drm_encoder_init(dev, &psb_intel_encoder->base, &psb_intel_sdvo_enc_funcs, 0);
|
||||
gma_encoder = &psb_intel_sdvo->base;
|
||||
gma_encoder->type = INTEL_OUTPUT_SDVO;
|
||||
drm_encoder_init(dev, &gma_encoder->base, &psb_intel_sdvo_enc_funcs, 0);
|
||||
|
||||
/* Read the regs to test if we can talk to the device */
|
||||
for (i = 0; i < 0x40; i++) {
|
||||
@ -2576,7 +2574,7 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
|
||||
else
|
||||
dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS;
|
||||
|
||||
drm_encoder_helper_add(&psb_intel_encoder->base, &psb_intel_sdvo_helper_funcs);
|
||||
drm_encoder_helper_add(&gma_encoder->base, &psb_intel_sdvo_helper_funcs);
|
||||
|
||||
/* In default case sdvo lvds is false */
|
||||
if (!psb_intel_sdvo_get_capabilities(psb_intel_sdvo, &psb_intel_sdvo->caps))
|
||||
@ -2619,7 +2617,7 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
|
||||
return true;
|
||||
|
||||
err:
|
||||
drm_encoder_cleanup(&psb_intel_encoder->base);
|
||||
drm_encoder_cleanup(&gma_encoder->base);
|
||||
i2c_del_adapter(&psb_intel_sdvo->ddc);
|
||||
kfree(psb_intel_sdvo);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user