Merge branch 'gma500-next' of git://github.com/patjak/drm-gma500 into drm-next
Here's some gma500 unifying and cleanups for drm-next. There is more stuff in the pipe for 3.12 but I'd like to get these out of the way first. * 'gma500-next' of git://github.com/patjak/drm-gma500: (35 commits) drm/gma500/cdv: Add and hook up chip op for disabling sr drm/gma500/cdv: Add and hook up chip op for watermarks drm/gma500: Rename psb_intel_encoder to gma_encoder drm/gma500: Rename psb_intel_connector to gma_connector drm/gma500: Rename psb_intel_crtc to gma_crtc drm/gma500/cdv: Convert to generic set_config() drm/gma500/psb: Convert to generic set_config() drm/gma500: Add generic set_config() function drm/gma500/cdv: Convert to generic save/restore drm/gma500/psb: Convert to generic save/restore drm/gma500: Add generic crtc save/restore funcs drm/gma500: Convert to generic encoder funcs drm/gma500: Add generic encoder functions drm/gma500/psb: Convert to generic cursor funcs drm/gma500/cdv: Convert to generic cursor funcs drm/gma500: Add generic cursor functions drm/gma500/psb: Convert to generic crtc->destroy drm/gma500/mdfld: Use identical generic crtc funcs drm/gma500/oak: Use identical generic crtc funcs drm/gma500/psb: Convert to gma_crtc_dpms() ...
This commit is contained in:
commit
291d284c60
|
@ -15,6 +15,7 @@ gma500_gfx-y += \
|
|||
mmu.o \
|
||||
power.o \
|
||||
psb_drv.o \
|
||||
gma_display.o \
|
||||
psb_intel_display.o \
|
||||
psb_intel_lvds.o \
|
||||
psb_intel_modes.o \
|
||||
|
|
|
@ -641,6 +641,7 @@ const struct psb_ops cdv_chip_ops = {
|
|||
|
||||
.crtc_helper = &cdv_intel_helper_funcs,
|
||||
.crtc_funcs = &cdv_intel_crtc_funcs,
|
||||
.clock_funcs = &cdv_clock_funcs,
|
||||
|
||||
.output_init = cdv_output_init,
|
||||
.hotplug = cdv_hotplug_event,
|
||||
|
@ -655,4 +656,6 @@ const struct psb_ops cdv_chip_ops = {
|
|||
.restore_regs = cdv_restore_display_registers,
|
||||
.power_down = cdv_power_down,
|
||||
.power_up = cdv_power_up,
|
||||
.update_wm = cdv_update_wm,
|
||||
.disable_sr = cdv_disable_sr,
|
||||
};
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
extern const struct drm_crtc_helper_funcs cdv_intel_helper_funcs;
|
||||
extern const struct drm_crtc_funcs cdv_intel_crtc_funcs;
|
||||
extern const struct gma_clock_funcs cdv_clock_funcs;
|
||||
extern void cdv_intel_crt_init(struct drm_device *dev,
|
||||
struct psb_intel_mode_device *mode_dev);
|
||||
extern void cdv_intel_lvds_init(struct drm_device *dev,
|
||||
|
@ -25,12 +26,5 @@ extern void cdv_hdmi_init(struct drm_device *dev, struct psb_intel_mode_device *
|
|||
int reg);
|
||||
extern struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev,
|
||||
struct drm_crtc *crtc);
|
||||
|
||||
static inline void cdv_intel_wait_for_vblank(struct drm_device *dev)
|
||||
{
|
||||
/* Wait for 20ms, i.e. one cycle at 50hz. */
|
||||
/* FIXME: msleep ?? */
|
||||
mdelay(20);
|
||||
}
|
||||
|
||||
|
||||
extern void cdv_update_wm(struct drm_device *dev, struct drm_crtc *crtc);
|
||||
extern void cdv_disable_sr(struct drm_device *dev);
|
||||
|
|
|
@ -95,13 +95,12 @@ static void cdv_intel_crt_mode_set(struct drm_encoder *encoder,
|
|||
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_crtc *crtc = encoder->crtc;
|
||||
struct psb_intel_crtc *psb_intel_crtc =
|
||||
to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
int dpll_md_reg;
|
||||
u32 adpa, dpll_md;
|
||||
u32 adpa_reg;
|
||||
|
||||
if (psb_intel_crtc->pipe == 0)
|
||||
if (gma_crtc->pipe == 0)
|
||||
dpll_md_reg = DPLL_A_MD;
|
||||
else
|
||||
dpll_md_reg = DPLL_B_MD;
|
||||
|
@ -124,7 +123,7 @@ static void cdv_intel_crt_mode_set(struct drm_encoder *encoder,
|
|||
if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
|
||||
adpa |= ADPA_VSYNC_ACTIVE_HIGH;
|
||||
|
||||
if (psb_intel_crtc->pipe == 0)
|
||||
if (gma_crtc->pipe == 0)
|
||||
adpa |= ADPA_PIPE_A_SELECT;
|
||||
else
|
||||
adpa |= ADPA_PIPE_B_SELECT;
|
||||
|
@ -197,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 =
|
||||
psb_intel_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);
|
||||
|
@ -208,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 =
|
||||
psb_intel_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,
|
||||
|
@ -227,8 +225,8 @@ static int cdv_intel_crt_set_property(struct drm_connector *connector,
|
|||
static const struct drm_encoder_helper_funcs cdv_intel_crt_helper_funcs = {
|
||||
.dpms = cdv_intel_crt_dpms,
|
||||
.mode_fixup = cdv_intel_crt_mode_fixup,
|
||||
.prepare = psb_intel_encoder_prepare,
|
||||
.commit = psb_intel_encoder_commit,
|
||||
.prepare = gma_encoder_prepare,
|
||||
.commit = gma_encoder_commit,
|
||||
.mode_set = cdv_intel_crt_mode_set,
|
||||
};
|
||||
|
||||
|
@ -244,7 +242,7 @@ static const struct drm_connector_helper_funcs
|
|||
cdv_intel_crt_connector_helper_funcs = {
|
||||
.mode_valid = cdv_intel_crt_mode_valid,
|
||||
.get_modes = cdv_intel_crt_get_modes,
|
||||
.best_encoder = psb_intel_best_encoder,
|
||||
.best_encoder = gma_best_encoder,
|
||||
};
|
||||
|
||||
static void cdv_intel_crt_enc_destroy(struct drm_encoder *encoder)
|
||||
|
@ -260,32 +258,31 @@ void cdv_intel_crt_init(struct drm_device *dev,
|
|||
struct psb_intel_mode_device *mode_dev)
|
||||
{
|
||||
|
||||
struct psb_intel_connector *psb_intel_connector;
|
||||
struct psb_intel_encoder *psb_intel_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
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;
|
||||
|
||||
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL);
|
||||
if (!psb_intel_connector)
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
|
||||
if (!gma_connector)
|
||||
goto failed_connector;
|
||||
|
||||
connector = &psb_intel_connector->base;
|
||||
connector = &gma_connector->base;
|
||||
connector->polled = DRM_CONNECTOR_POLL_HPD;
|
||||
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);
|
||||
|
||||
psb_intel_connector_attach_encoder(psb_intel_connector,
|
||||
psb_intel_encoder);
|
||||
gma_connector_attach_encoder(gma_connector, gma_encoder);
|
||||
|
||||
/* Set up the DDC bus. */
|
||||
i2c_reg = GPIOA;
|
||||
|
@ -294,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);
|
||||
|
@ -318,10 +315,10 @@ void cdv_intel_crt_init(struct drm_device *dev,
|
|||
|
||||
return;
|
||||
failed_ddc:
|
||||
drm_encoder_cleanup(&psb_intel_encoder->base);
|
||||
drm_connector_cleanup(&psb_intel_connector->base);
|
||||
kfree(psb_intel_connector);
|
||||
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;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -34,6 +34,7 @@
|
|||
#include "psb_drv.h"
|
||||
#include "psb_intel_drv.h"
|
||||
#include "psb_intel_reg.h"
|
||||
#include "gma_display.h"
|
||||
#include <drm/drm_dp_helper.h>
|
||||
|
||||
#define _wait_for(COND, MS, W) ({ \
|
||||
|
@ -68,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];
|
||||
|
@ -114,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;
|
||||
|
@ -143,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];
|
||||
|
@ -180,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;
|
||||
|
@ -200,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;
|
||||
|
@ -215,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;
|
||||
|
@ -242,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 ;
|
||||
|
@ -274,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;
|
||||
|
@ -294,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;
|
||||
|
@ -314,7 +315,7 @@ static int
|
|||
cdv_intel_dp_mode_valid(struct drm_connector *connector,
|
||||
struct drm_display_mode *mode)
|
||||
{
|
||||
struct psb_intel_encoder *encoder = psb_intel_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);
|
||||
|
@ -370,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)
|
||||
{
|
||||
|
@ -472,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;
|
||||
|
@ -504,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);
|
||||
|
@ -512,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];
|
||||
|
@ -557,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];
|
||||
|
@ -647,7 +648,8 @@ cdv_intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
|
|||
}
|
||||
|
||||
static int
|
||||
cdv_intel_dp_i2c_init(struct psb_intel_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;
|
||||
|
@ -698,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);
|
||||
|
@ -792,22 +794,22 @@ cdv_intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
|
|||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct drm_encoder *encoder;
|
||||
struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
int lane_count = 4, bpp = 24;
|
||||
struct cdv_intel_dp_m_n m_n;
|
||||
int pipe = intel_crtc->pipe;
|
||||
int pipe = gma_crtc->pipe;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
@ -841,9 +843,9 @@ 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 psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
|
||||
struct drm_device *dev = encoder->dev;
|
||||
|
||||
|
@ -885,7 +887,7 @@ cdv_intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode
|
|||
}
|
||||
|
||||
/* CPT DP's pipe select is decided in TRANS_DP_CTL */
|
||||
if (intel_crtc->pipe == 1)
|
||||
if (gma_crtc->pipe == 1)
|
||||
intel_dp->DP |= DP_PIPEB_SELECT;
|
||||
|
||||
REG_WRITE(intel_dp->output_reg, (intel_dp->DP | DP_PORT_EN));
|
||||
|
@ -900,7 +902,7 @@ cdv_intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode
|
|||
else
|
||||
pfit_control = 0;
|
||||
|
||||
pfit_control |= intel_crtc->pipe << PFIT_PIPE_SHIFT;
|
||||
pfit_control |= gma_crtc->pipe << PFIT_PIPE_SHIFT;
|
||||
|
||||
REG_WRITE(PFIT_CONTROL, pfit_control);
|
||||
}
|
||||
|
@ -908,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;
|
||||
|
@ -940,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) {
|
||||
|
@ -957,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)
|
||||
|
@ -971,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);
|
||||
|
@ -1006,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;
|
||||
|
@ -1031,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,
|
||||
|
@ -1105,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;
|
||||
|
@ -1164,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;
|
||||
|
@ -1184,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)
|
||||
{
|
||||
|
@ -1211,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)
|
||||
{
|
||||
|
||||
|
@ -1232,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;
|
||||
|
@ -1298,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;
|
||||
|
@ -1317,7 +1319,7 @@ cdv_intel_dp_start_link_train(struct psb_intel_encoder *encoder)
|
|||
/* Enable output, wait for it to become active */
|
||||
REG_WRITE(intel_dp->output_reg, reg);
|
||||
REG_READ(intel_dp->output_reg);
|
||||
psb_intel_wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
DRM_DEBUG_KMS("Link config\n");
|
||||
/* Write the link configuration data */
|
||||
|
@ -1392,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;
|
||||
|
@ -1478,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;
|
||||
|
@ -1502,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;
|
||||
|
@ -1531,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 = psb_intel_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;
|
||||
|
@ -1565,7 +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 = psb_intel_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;
|
||||
|
@ -1621,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 = psb_intel_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;
|
||||
|
@ -1647,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 = psb_intel_attached_encoder(connector);
|
||||
struct gma_encoder *encoder = gma_attached_encoder(connector);
|
||||
struct cdv_intel_dp *intel_dp = encoder->dev_priv;
|
||||
int ret;
|
||||
|
||||
|
@ -1700,11 +1701,10 @@ done:
|
|||
static void
|
||||
cdv_intel_dp_destroy(struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_encoder *psb_intel_encoder =
|
||||
psb_intel_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);
|
||||
|
@ -1741,7 +1741,7 @@ static const struct drm_connector_funcs cdv_intel_dp_connector_funcs = {
|
|||
static const struct drm_connector_helper_funcs cdv_intel_dp_connector_helper_funcs = {
|
||||
.get_modes = cdv_intel_dp_get_modes,
|
||||
.mode_valid = cdv_intel_dp_mode_valid,
|
||||
.best_encoder = psb_intel_best_encoder,
|
||||
.best_encoder = gma_best_encoder,
|
||||
};
|
||||
|
||||
static const struct drm_encoder_funcs cdv_intel_dp_enc_funcs = {
|
||||
|
@ -1800,19 +1800,19 @@ 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 psb_intel_connector *psb_intel_connector;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
struct cdv_intel_dp *intel_dp;
|
||||
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;
|
||||
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL);
|
||||
if (!psb_intel_connector)
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
|
||||
if (!gma_connector)
|
||||
goto err_connector;
|
||||
intel_dp = kzalloc(sizeof(struct cdv_intel_dp), GFP_KERNEL);
|
||||
if (!intel_dp)
|
||||
|
@ -1821,22 +1821,22 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
|
|||
if ((output_reg == DP_C) && cdv_intel_dpc_is_edp(dev))
|
||||
type = DRM_MODE_CONNECTOR_eDP;
|
||||
|
||||
connector = &psb_intel_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
connector = &gma_connector->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);
|
||||
|
||||
psb_intel_connector_attach_encoder(psb_intel_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);
|
||||
|
@ -1852,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(psb_intel_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;
|
||||
|
@ -1920,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");
|
||||
|
@ -1945,7 +1945,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev
|
|||
return;
|
||||
|
||||
err_priv:
|
||||
kfree(psb_intel_connector);
|
||||
kfree(gma_connector);
|
||||
err_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
|
|
@ -64,11 +64,11 @@ 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 psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
|
||||
hdmib = (2 << 10);
|
||||
|
||||
|
@ -77,7 +77,7 @@ static void cdv_hdmi_mode_set(struct drm_encoder *encoder,
|
|||
if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
|
||||
hdmib |= HDMI_HSYNC_ACTIVE_HIGH;
|
||||
|
||||
if (intel_crtc->pipe == 1)
|
||||
if (gma_crtc->pipe == 1)
|
||||
hdmib |= HDMIB_PIPE_B_SELECT;
|
||||
|
||||
if (hdmi_priv->has_hdmi_audio) {
|
||||
|
@ -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 =
|
||||
psb_intel_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 =
|
||||
psb_intel_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 =
|
||||
psb_intel_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;
|
||||
|
@ -167,7 +163,7 @@ static int cdv_hdmi_set_property(struct drm_connector *connector,
|
|||
struct drm_encoder *encoder = connector->encoder;
|
||||
|
||||
if (!strcmp(property->name, "scaling mode") && encoder) {
|
||||
struct psb_intel_crtc *crtc = to_psb_intel_crtc(encoder->crtc);
|
||||
struct gma_crtc *crtc = to_gma_crtc(encoder->crtc);
|
||||
bool centre;
|
||||
uint64_t curValue;
|
||||
|
||||
|
@ -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 =
|
||||
psb_intel_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 =
|
||||
psb_intel_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);
|
||||
|
@ -269,16 +263,16 @@ static void cdv_hdmi_destroy(struct drm_connector *connector)
|
|||
static const struct drm_encoder_helper_funcs cdv_hdmi_helper_funcs = {
|
||||
.dpms = cdv_hdmi_dpms,
|
||||
.mode_fixup = cdv_hdmi_mode_fixup,
|
||||
.prepare = psb_intel_encoder_prepare,
|
||||
.prepare = gma_encoder_prepare,
|
||||
.mode_set = cdv_hdmi_mode_set,
|
||||
.commit = psb_intel_encoder_commit,
|
||||
.commit = gma_encoder_commit,
|
||||
};
|
||||
|
||||
static const struct drm_connector_helper_funcs
|
||||
cdv_hdmi_connector_helper_funcs = {
|
||||
.get_modes = cdv_hdmi_get_modes,
|
||||
.mode_valid = cdv_hdmi_mode_valid,
|
||||
.best_encoder = psb_intel_best_encoder,
|
||||
.best_encoder = gma_best_encoder,
|
||||
};
|
||||
|
||||
static const struct drm_connector_funcs cdv_hdmi_connector_funcs = {
|
||||
|
@ -294,23 +288,22 @@ 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 psb_intel_connector *psb_intel_connector;
|
||||
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;
|
||||
|
||||
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector),
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!psb_intel_connector)
|
||||
if (!gma_connector)
|
||||
goto err_connector;
|
||||
|
||||
hdmi_priv = kzalloc(sizeof(struct mid_intel_hdmi_priv), GFP_KERNEL);
|
||||
|
@ -318,9 +311,9 @@ void cdv_hdmi_init(struct drm_device *dev,
|
|||
if (!hdmi_priv)
|
||||
goto err_priv;
|
||||
|
||||
connector = &psb_intel_connector->base;
|
||||
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,12 +321,11 @@ void cdv_hdmi_init(struct drm_device *dev,
|
|||
drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
|
||||
DRM_MODE_ENCODER_TMDS);
|
||||
|
||||
psb_intel_connector_attach_encoder(psb_intel_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,
|
||||
|
@ -349,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);
|
||||
|
@ -361,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;
|
||||
|
@ -379,7 +370,7 @@ failed_ddc:
|
|||
drm_encoder_cleanup(encoder);
|
||||
drm_connector_cleanup(connector);
|
||||
err_priv:
|
||||
kfree(psb_intel_connector);
|
||||
kfree(gma_connector);
|
||||
err_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
|
|
@ -356,8 +356,7 @@ static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder,
|
|||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(
|
||||
encoder->crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc);
|
||||
u32 pfit_control;
|
||||
|
||||
/*
|
||||
|
@ -379,7 +378,7 @@ static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder,
|
|||
else
|
||||
pfit_control = 0;
|
||||
|
||||
pfit_control |= psb_intel_crtc->pipe << PFIT_PIPE_SHIFT;
|
||||
pfit_control |= gma_crtc->pipe << PFIT_PIPE_SHIFT;
|
||||
|
||||
if (dev_priv->lvds_dither)
|
||||
pfit_control |= PANEL_8TO6_DITHER_ENABLE;
|
||||
|
@ -407,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 =
|
||||
psb_intel_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;
|
||||
|
@ -444,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 =
|
||||
psb_intel_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);
|
||||
|
@ -461,8 +458,7 @@ static int cdv_intel_lvds_set_property(struct drm_connector *connector,
|
|||
struct drm_encoder *encoder = connector->encoder;
|
||||
|
||||
if (!strcmp(property->name, "scaling mode") && encoder) {
|
||||
struct psb_intel_crtc *crtc =
|
||||
to_psb_intel_crtc(encoder->crtc);
|
||||
struct gma_crtc *crtc = to_gma_crtc(encoder->crtc);
|
||||
uint64_t curValue;
|
||||
|
||||
if (!crtc)
|
||||
|
@ -529,7 +525,7 @@ static const struct drm_connector_helper_funcs
|
|||
cdv_intel_lvds_connector_helper_funcs = {
|
||||
.get_modes = cdv_intel_lvds_get_modes,
|
||||
.mode_valid = cdv_intel_lvds_mode_valid,
|
||||
.best_encoder = psb_intel_best_encoder,
|
||||
.best_encoder = gma_best_encoder,
|
||||
};
|
||||
|
||||
static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = {
|
||||
|
@ -612,8 +608,8 @@ 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 psb_intel_connector *psb_intel_connector;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct cdv_intel_lvds_priv *lvds_priv;
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
|
@ -630,24 +626,24 @@ 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;
|
||||
|
||||
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector),
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector),
|
||||
GFP_KERNEL);
|
||||
if (!psb_intel_connector)
|
||||
if (!gma_connector)
|
||||
goto failed_connector;
|
||||
|
||||
lvds_priv = kzalloc(sizeof(struct cdv_intel_lvds_priv), GFP_KERNEL);
|
||||
if (!lvds_priv)
|
||||
goto failed_lvds_priv;
|
||||
|
||||
psb_intel_encoder->dev_priv = lvds_priv;
|
||||
gma_encoder->dev_priv = lvds_priv;
|
||||
|
||||
connector = &psb_intel_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
connector = &gma_connector->base;
|
||||
encoder = &gma_encoder->base;
|
||||
|
||||
|
||||
drm_connector_init(dev, connector,
|
||||
|
@ -659,9 +655,8 @@ void cdv_intel_lvds_init(struct drm_device *dev,
|
|||
DRM_MODE_ENCODER_LVDS);
|
||||
|
||||
|
||||
psb_intel_connector_attach_encoder(psb_intel_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,
|
||||
|
@ -682,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:
|
||||
|
@ -704,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;
|
||||
|
@ -718,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 =
|
||||
|
@ -782,19 +777,19 @@ 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);
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(lvds_priv);
|
||||
failed_lvds_priv:
|
||||
kfree(psb_intel_connector);
|
||||
kfree(gma_connector);
|
||||
failed_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
|
|
@ -520,21 +520,21 @@ static struct drm_framebuffer *psb_user_framebuffer_create
|
|||
static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
|
||||
u16 blue, int regno)
|
||||
{
|
||||
struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
|
||||
intel_crtc->lut_r[regno] = red >> 8;
|
||||
intel_crtc->lut_g[regno] = green >> 8;
|
||||
intel_crtc->lut_b[regno] = blue >> 8;
|
||||
gma_crtc->lut_r[regno] = red >> 8;
|
||||
gma_crtc->lut_g[regno] = green >> 8;
|
||||
gma_crtc->lut_b[regno] = blue >> 8;
|
||||
}
|
||||
|
||||
static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red,
|
||||
u16 *green, u16 *blue, int regno)
|
||||
{
|
||||
struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
|
||||
*red = intel_crtc->lut_r[regno] << 8;
|
||||
*green = intel_crtc->lut_g[regno] << 8;
|
||||
*blue = intel_crtc->lut_b[regno] << 8;
|
||||
*red = gma_crtc->lut_r[regno] << 8;
|
||||
*green = gma_crtc->lut_g[regno] << 8;
|
||||
*blue = gma_crtc->lut_b[regno] << 8;
|
||||
}
|
||||
|
||||
static int psbfb_probe(struct drm_fb_helper *helper,
|
||||
|
@ -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 =
|
||||
psb_intel_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);
|
||||
|
@ -744,7 +743,7 @@ static void psb_setup_outputs(struct drm_device *dev)
|
|||
}
|
||||
encoder->possible_crtcs = crtc_mask;
|
||||
encoder->possible_clones =
|
||||
psb_intel_connector_clones(dev, clone_mask);
|
||||
gma_connector_clones(dev, clone_mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ struct psb_fbdev {
|
|||
|
||||
#define to_psb_fb(x) container_of(x, struct psb_framebuffer, base)
|
||||
|
||||
extern int psb_intel_connector_clones(struct drm_device *dev, int type_mask);
|
||||
extern int gma_connector_clones(struct drm_device *dev, int type_mask);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,776 @@
|
|||
/*
|
||||
* Copyright © 2006-2011 Intel Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Authors:
|
||||
* Eric Anholt <eric@anholt.net>
|
||||
* Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
|
||||
*/
|
||||
|
||||
#include <drm/drmP.h>
|
||||
#include "gma_display.h"
|
||||
#include "psb_intel_drv.h"
|
||||
#include "psb_intel_reg.h"
|
||||
#include "psb_drv.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
/**
|
||||
* Returns whether any output on the specified pipe is of the specified type
|
||||
*/
|
||||
bool gma_pipe_has_type(struct drm_crtc *crtc, int type)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct drm_connector *l_entry;
|
||||
|
||||
list_for_each_entry(l_entry, &mode_config->connector_list, head) {
|
||||
if (l_entry->encoder && l_entry->encoder->crtc == crtc) {
|
||||
struct gma_encoder *gma_encoder =
|
||||
gma_attached_encoder(l_entry);
|
||||
if (gma_encoder->type == type)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void gma_wait_for_vblank(struct drm_device *dev)
|
||||
{
|
||||
/* Wait for 20ms, i.e. one cycle at 50hz. */
|
||||
mdelay(20);
|
||||
}
|
||||
|
||||
int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
|
||||
struct drm_framebuffer *old_fb)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
|
||||
int pipe = gma_crtc->pipe;
|
||||
const struct psb_offset *map = &dev_priv->regmap[pipe];
|
||||
unsigned long start, offset;
|
||||
u32 dspcntr;
|
||||
int ret = 0;
|
||||
|
||||
if (!gma_power_begin(dev, true))
|
||||
return 0;
|
||||
|
||||
/* no fb bound */
|
||||
if (!crtc->fb) {
|
||||
dev_err(dev->dev, "No FB bound\n");
|
||||
goto gma_pipe_cleaner;
|
||||
}
|
||||
|
||||
/* We are displaying this buffer, make sure it is actually loaded
|
||||
into the GTT */
|
||||
ret = psb_gtt_pin(psbfb->gtt);
|
||||
if (ret < 0)
|
||||
goto gma_pipe_set_base_exit;
|
||||
start = psbfb->gtt->offset;
|
||||
offset = y * crtc->fb->pitches[0] + x * (crtc->fb->bits_per_pixel / 8);
|
||||
|
||||
REG_WRITE(map->stride, crtc->fb->pitches[0]);
|
||||
|
||||
dspcntr = REG_READ(map->cntr);
|
||||
dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
|
||||
|
||||
switch (crtc->fb->bits_per_pixel) {
|
||||
case 8:
|
||||
dspcntr |= DISPPLANE_8BPP;
|
||||
break;
|
||||
case 16:
|
||||
if (crtc->fb->depth == 15)
|
||||
dspcntr |= DISPPLANE_15_16BPP;
|
||||
else
|
||||
dspcntr |= DISPPLANE_16BPP;
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
dspcntr |= DISPPLANE_32BPP_NO_ALPHA;
|
||||
break;
|
||||
default:
|
||||
dev_err(dev->dev, "Unknown color depth\n");
|
||||
ret = -EINVAL;
|
||||
goto gma_pipe_set_base_exit;
|
||||
}
|
||||
REG_WRITE(map->cntr, dspcntr);
|
||||
|
||||
dev_dbg(dev->dev,
|
||||
"Writing base %08lX %08lX %d %d\n", start, offset, x, y);
|
||||
|
||||
/* FIXME: Investigate whether this really is the base for psb and why
|
||||
the linear offset is named base for the other chips. map->surf
|
||||
should be the base and map->linoff the offset for all chips */
|
||||
if (IS_PSB(dev)) {
|
||||
REG_WRITE(map->base, offset + start);
|
||||
REG_READ(map->base);
|
||||
} else {
|
||||
REG_WRITE(map->base, offset);
|
||||
REG_READ(map->base);
|
||||
REG_WRITE(map->surf, start);
|
||||
REG_READ(map->surf);
|
||||
}
|
||||
|
||||
gma_pipe_cleaner:
|
||||
/* If there was a previous display we can now unpin it */
|
||||
if (old_fb)
|
||||
psb_gtt_unpin(to_psb_fb(old_fb)->gtt);
|
||||
|
||||
gma_pipe_set_base_exit:
|
||||
gma_power_end(dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Loads the palette/gamma unit for the CRTC with the prepared values */
|
||||
void gma_crtc_load_lut(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
const struct psb_offset *map = &dev_priv->regmap[gma_crtc->pipe];
|
||||
int palreg = map->palette;
|
||||
int i;
|
||||
|
||||
/* The clocks have to be on to load the palette. */
|
||||
if (!crtc->enabled)
|
||||
return;
|
||||
|
||||
if (gma_power_begin(dev, false)) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
REG_WRITE(palreg + 4 * i,
|
||||
((gma_crtc->lut_r[i] +
|
||||
gma_crtc->lut_adj[i]) << 16) |
|
||||
((gma_crtc->lut_g[i] +
|
||||
gma_crtc->lut_adj[i]) << 8) |
|
||||
(gma_crtc->lut_b[i] +
|
||||
gma_crtc->lut_adj[i]));
|
||||
}
|
||||
gma_power_end(dev);
|
||||
} else {
|
||||
for (i = 0; i < 256; i++) {
|
||||
/* FIXME: Why pipe[0] and not pipe[..._crtc->pipe]? */
|
||||
dev_priv->regs.pipe[0].palette[i] =
|
||||
((gma_crtc->lut_r[i] +
|
||||
gma_crtc->lut_adj[i]) << 16) |
|
||||
((gma_crtc->lut_g[i] +
|
||||
gma_crtc->lut_adj[i]) << 8) |
|
||||
(gma_crtc->lut_b[i] +
|
||||
gma_crtc->lut_adj[i]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue,
|
||||
u32 start, u32 size)
|
||||
{
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
int i;
|
||||
int end = (start + size > 256) ? 256 : start + size;
|
||||
|
||||
for (i = start; i < end; i++) {
|
||||
gma_crtc->lut_r[i] = red[i] >> 8;
|
||||
gma_crtc->lut_g[i] = green[i] >> 8;
|
||||
gma_crtc->lut_b[i] = blue[i] >> 8;
|
||||
}
|
||||
|
||||
gma_crtc_load_lut(crtc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the power management mode of the pipe and plane.
|
||||
*
|
||||
* This code should probably grow support for turning the cursor off and back
|
||||
* on appropriately at the same time as we're turning the pipe off/on.
|
||||
*/
|
||||
void gma_crtc_dpms(struct drm_crtc *crtc, int mode)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
int pipe = gma_crtc->pipe;
|
||||
const struct psb_offset *map = &dev_priv->regmap[pipe];
|
||||
u32 temp;
|
||||
|
||||
/* XXX: When our outputs are all unaware of DPMS modes other than off
|
||||
* and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC.
|
||||
*/
|
||||
|
||||
if (IS_CDV(dev))
|
||||
dev_priv->ops->disable_sr(dev);
|
||||
|
||||
switch (mode) {
|
||||
case DRM_MODE_DPMS_ON:
|
||||
case DRM_MODE_DPMS_STANDBY:
|
||||
case DRM_MODE_DPMS_SUSPEND:
|
||||
if (gma_crtc->active)
|
||||
break;
|
||||
|
||||
gma_crtc->active = true;
|
||||
|
||||
/* Enable the DPLL */
|
||||
temp = REG_READ(map->dpll);
|
||||
if ((temp & DPLL_VCO_ENABLE) == 0) {
|
||||
REG_WRITE(map->dpll, temp);
|
||||
REG_READ(map->dpll);
|
||||
/* Wait for the clocks to stabilize. */
|
||||
udelay(150);
|
||||
REG_WRITE(map->dpll, temp | DPLL_VCO_ENABLE);
|
||||
REG_READ(map->dpll);
|
||||
/* Wait for the clocks to stabilize. */
|
||||
udelay(150);
|
||||
REG_WRITE(map->dpll, temp | DPLL_VCO_ENABLE);
|
||||
REG_READ(map->dpll);
|
||||
/* Wait for the clocks to stabilize. */
|
||||
udelay(150);
|
||||
}
|
||||
|
||||
/* Enable the plane */
|
||||
temp = REG_READ(map->cntr);
|
||||
if ((temp & DISPLAY_PLANE_ENABLE) == 0) {
|
||||
REG_WRITE(map->cntr,
|
||||
temp | DISPLAY_PLANE_ENABLE);
|
||||
/* Flush the plane changes */
|
||||
REG_WRITE(map->base, REG_READ(map->base));
|
||||
}
|
||||
|
||||
udelay(150);
|
||||
|
||||
/* Enable the pipe */
|
||||
temp = REG_READ(map->conf);
|
||||
if ((temp & PIPEACONF_ENABLE) == 0)
|
||||
REG_WRITE(map->conf, temp | PIPEACONF_ENABLE);
|
||||
|
||||
temp = REG_READ(map->status);
|
||||
temp &= ~(0xFFFF);
|
||||
temp |= PIPE_FIFO_UNDERRUN;
|
||||
REG_WRITE(map->status, temp);
|
||||
REG_READ(map->status);
|
||||
|
||||
gma_crtc_load_lut(crtc);
|
||||
|
||||
/* Give the overlay scaler a chance to enable
|
||||
* if it's on this pipe */
|
||||
/* psb_intel_crtc_dpms_video(crtc, true); TODO */
|
||||
break;
|
||||
case DRM_MODE_DPMS_OFF:
|
||||
if (!gma_crtc->active)
|
||||
break;
|
||||
|
||||
gma_crtc->active = false;
|
||||
|
||||
/* Give the overlay scaler a chance to disable
|
||||
* if it's on this pipe */
|
||||
/* psb_intel_crtc_dpms_video(crtc, FALSE); TODO */
|
||||
|
||||
/* Disable the VGA plane that we never use */
|
||||
REG_WRITE(VGACNTRL, VGA_DISP_DISABLE);
|
||||
|
||||
/* Turn off vblank interrupts */
|
||||
drm_vblank_off(dev, pipe);
|
||||
|
||||
/* Wait for vblank for the disable to take effect */
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
/* Disable plane */
|
||||
temp = REG_READ(map->cntr);
|
||||
if ((temp & DISPLAY_PLANE_ENABLE) != 0) {
|
||||
REG_WRITE(map->cntr,
|
||||
temp & ~DISPLAY_PLANE_ENABLE);
|
||||
/* Flush the plane changes */
|
||||
REG_WRITE(map->base, REG_READ(map->base));
|
||||
REG_READ(map->base);
|
||||
}
|
||||
|
||||
/* Disable pipe */
|
||||
temp = REG_READ(map->conf);
|
||||
if ((temp & PIPEACONF_ENABLE) != 0) {
|
||||
REG_WRITE(map->conf, temp & ~PIPEACONF_ENABLE);
|
||||
REG_READ(map->conf);
|
||||
}
|
||||
|
||||
/* Wait for vblank for the disable to take effect. */
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
udelay(150);
|
||||
|
||||
/* Disable DPLL */
|
||||
temp = REG_READ(map->dpll);
|
||||
if ((temp & DPLL_VCO_ENABLE) != 0) {
|
||||
REG_WRITE(map->dpll, temp & ~DPLL_VCO_ENABLE);
|
||||
REG_READ(map->dpll);
|
||||
}
|
||||
|
||||
/* Wait for the clocks to turn off. */
|
||||
udelay(150);
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_CDV(dev))
|
||||
dev_priv->ops->update_wm(dev, crtc);
|
||||
|
||||
/* Set FIFO watermarks */
|
||||
REG_WRITE(DSPARB, 0x3F3E);
|
||||
}
|
||||
|
||||
int gma_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
struct drm_file *file_priv,
|
||||
uint32_t handle,
|
||||
uint32_t width, uint32_t height)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
int pipe = gma_crtc->pipe;
|
||||
uint32_t control = (pipe == 0) ? CURACNTR : CURBCNTR;
|
||||
uint32_t base = (pipe == 0) ? CURABASE : CURBBASE;
|
||||
uint32_t temp;
|
||||
size_t addr = 0;
|
||||
struct gtt_range *gt;
|
||||
struct gtt_range *cursor_gt = gma_crtc->cursor_gt;
|
||||
struct drm_gem_object *obj;
|
||||
void *tmp_dst, *tmp_src;
|
||||
int ret = 0, i, cursor_pages;
|
||||
|
||||
/* If we didn't get a handle then turn the cursor off */
|
||||
if (!handle) {
|
||||
temp = CURSOR_MODE_DISABLE;
|
||||
|
||||
if (gma_power_begin(dev, false)) {
|
||||
REG_WRITE(control, temp);
|
||||
REG_WRITE(base, 0);
|
||||
gma_power_end(dev);
|
||||
}
|
||||
|
||||
/* Unpin the old GEM object */
|
||||
if (gma_crtc->cursor_obj) {
|
||||
gt = container_of(gma_crtc->cursor_obj,
|
||||
struct gtt_range, gem);
|
||||
psb_gtt_unpin(gt);
|
||||
drm_gem_object_unreference(gma_crtc->cursor_obj);
|
||||
gma_crtc->cursor_obj = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Currently we only support 64x64 cursors */
|
||||
if (width != 64 || height != 64) {
|
||||
dev_dbg(dev->dev, "We currently only support 64x64 cursors\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
obj = drm_gem_object_lookup(dev, file_priv, handle);
|
||||
if (!obj)
|
||||
return -ENOENT;
|
||||
|
||||
if (obj->size < width * height * 4) {
|
||||
dev_dbg(dev->dev, "Buffer is too small\n");
|
||||
ret = -ENOMEM;
|
||||
goto unref_cursor;
|
||||
}
|
||||
|
||||
gt = container_of(obj, struct gtt_range, gem);
|
||||
|
||||
/* Pin the memory into the GTT */
|
||||
ret = psb_gtt_pin(gt);
|
||||
if (ret) {
|
||||
dev_err(dev->dev, "Can not pin down handle 0x%x\n", handle);
|
||||
goto unref_cursor;
|
||||
}
|
||||
|
||||
if (dev_priv->ops->cursor_needs_phys) {
|
||||
if (cursor_gt == NULL) {
|
||||
dev_err(dev->dev, "No hardware cursor mem available");
|
||||
ret = -ENOMEM;
|
||||
goto unref_cursor;
|
||||
}
|
||||
|
||||
/* Prevent overflow */
|
||||
if (gt->npage > 4)
|
||||
cursor_pages = 4;
|
||||
else
|
||||
cursor_pages = gt->npage;
|
||||
|
||||
/* Copy the cursor to cursor mem */
|
||||
tmp_dst = dev_priv->vram_addr + cursor_gt->offset;
|
||||
for (i = 0; i < cursor_pages; i++) {
|
||||
tmp_src = kmap(gt->pages[i]);
|
||||
memcpy(tmp_dst, tmp_src, PAGE_SIZE);
|
||||
kunmap(gt->pages[i]);
|
||||
tmp_dst += PAGE_SIZE;
|
||||
}
|
||||
|
||||
addr = gma_crtc->cursor_addr;
|
||||
} else {
|
||||
addr = gt->offset;
|
||||
gma_crtc->cursor_addr = addr;
|
||||
}
|
||||
|
||||
temp = 0;
|
||||
/* set the pipe for the cursor */
|
||||
temp |= (pipe << 28);
|
||||
temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
|
||||
|
||||
if (gma_power_begin(dev, false)) {
|
||||
REG_WRITE(control, temp);
|
||||
REG_WRITE(base, addr);
|
||||
gma_power_end(dev);
|
||||
}
|
||||
|
||||
/* unpin the old bo */
|
||||
if (gma_crtc->cursor_obj) {
|
||||
gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem);
|
||||
psb_gtt_unpin(gt);
|
||||
drm_gem_object_unreference(gma_crtc->cursor_obj);
|
||||
}
|
||||
|
||||
gma_crtc->cursor_obj = obj;
|
||||
return ret;
|
||||
|
||||
unref_cursor:
|
||||
drm_gem_object_unreference(obj);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
int pipe = gma_crtc->pipe;
|
||||
uint32_t temp = 0;
|
||||
uint32_t addr;
|
||||
|
||||
if (x < 0) {
|
||||
temp |= (CURSOR_POS_SIGN << CURSOR_X_SHIFT);
|
||||
x = -x;
|
||||
}
|
||||
if (y < 0) {
|
||||
temp |= (CURSOR_POS_SIGN << CURSOR_Y_SHIFT);
|
||||
y = -y;
|
||||
}
|
||||
|
||||
temp |= ((x & CURSOR_POS_MASK) << CURSOR_X_SHIFT);
|
||||
temp |= ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT);
|
||||
|
||||
addr = gma_crtc->cursor_addr;
|
||||
|
||||
if (gma_power_begin(dev, false)) {
|
||||
REG_WRITE((pipe == 0) ? CURAPOS : CURBPOS, temp);
|
||||
REG_WRITE((pipe == 0) ? CURABASE : CURBBASE, addr);
|
||||
gma_power_end(dev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool gma_crtc_mode_fixup(struct drm_crtc *crtc,
|
||||
const struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void gma_crtc_prepare(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
|
||||
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
|
||||
}
|
||||
|
||||
void gma_crtc_commit(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
|
||||
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON);
|
||||
}
|
||||
|
||||
void gma_crtc_disable(struct drm_crtc *crtc)
|
||||
{
|
||||
struct gtt_range *gt;
|
||||
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
|
||||
|
||||
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
|
||||
|
||||
if (crtc->fb) {
|
||||
gt = to_psb_fb(crtc->fb)->gtt;
|
||||
psb_gtt_unpin(gt);
|
||||
}
|
||||
}
|
||||
|
||||
void gma_crtc_destroy(struct drm_crtc *crtc)
|
||||
{
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
|
||||
kfree(gma_crtc->crtc_state);
|
||||
drm_crtc_cleanup(crtc);
|
||||
kfree(gma_crtc);
|
||||
}
|
||||
|
||||
int gma_crtc_set_config(struct drm_mode_set *set)
|
||||
{
|
||||
struct drm_device *dev = set->crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
int ret;
|
||||
|
||||
if (!dev_priv->rpm_enabled)
|
||||
return drm_crtc_helper_set_config(set);
|
||||
|
||||
pm_runtime_forbid(&dev->pdev->dev);
|
||||
ret = drm_crtc_helper_set_config(set);
|
||||
pm_runtime_allow(&dev->pdev->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save HW states of given crtc
|
||||
*/
|
||||
void gma_crtc_save(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct psb_intel_crtc_state *crtc_state = gma_crtc->crtc_state;
|
||||
const struct psb_offset *map = &dev_priv->regmap[gma_crtc->pipe];
|
||||
uint32_t palette_reg;
|
||||
int i;
|
||||
|
||||
if (!crtc_state) {
|
||||
dev_err(dev->dev, "No CRTC state found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
crtc_state->saveDSPCNTR = REG_READ(map->cntr);
|
||||
crtc_state->savePIPECONF = REG_READ(map->conf);
|
||||
crtc_state->savePIPESRC = REG_READ(map->src);
|
||||
crtc_state->saveFP0 = REG_READ(map->fp0);
|
||||
crtc_state->saveFP1 = REG_READ(map->fp1);
|
||||
crtc_state->saveDPLL = REG_READ(map->dpll);
|
||||
crtc_state->saveHTOTAL = REG_READ(map->htotal);
|
||||
crtc_state->saveHBLANK = REG_READ(map->hblank);
|
||||
crtc_state->saveHSYNC = REG_READ(map->hsync);
|
||||
crtc_state->saveVTOTAL = REG_READ(map->vtotal);
|
||||
crtc_state->saveVBLANK = REG_READ(map->vblank);
|
||||
crtc_state->saveVSYNC = REG_READ(map->vsync);
|
||||
crtc_state->saveDSPSTRIDE = REG_READ(map->stride);
|
||||
|
||||
/* NOTE: DSPSIZE DSPPOS only for psb */
|
||||
crtc_state->saveDSPSIZE = REG_READ(map->size);
|
||||
crtc_state->saveDSPPOS = REG_READ(map->pos);
|
||||
|
||||
crtc_state->saveDSPBASE = REG_READ(map->base);
|
||||
|
||||
palette_reg = map->palette;
|
||||
for (i = 0; i < 256; ++i)
|
||||
crtc_state->savePalette[i] = REG_READ(palette_reg + (i << 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore HW states of given crtc
|
||||
*/
|
||||
void gma_crtc_restore(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct psb_intel_crtc_state *crtc_state = gma_crtc->crtc_state;
|
||||
const struct psb_offset *map = &dev_priv->regmap[gma_crtc->pipe];
|
||||
uint32_t palette_reg;
|
||||
int i;
|
||||
|
||||
if (!crtc_state) {
|
||||
dev_err(dev->dev, "No crtc state\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (crtc_state->saveDPLL & DPLL_VCO_ENABLE) {
|
||||
REG_WRITE(map->dpll,
|
||||
crtc_state->saveDPLL & ~DPLL_VCO_ENABLE);
|
||||
REG_READ(map->dpll);
|
||||
udelay(150);
|
||||
}
|
||||
|
||||
REG_WRITE(map->fp0, crtc_state->saveFP0);
|
||||
REG_READ(map->fp0);
|
||||
|
||||
REG_WRITE(map->fp1, crtc_state->saveFP1);
|
||||
REG_READ(map->fp1);
|
||||
|
||||
REG_WRITE(map->dpll, crtc_state->saveDPLL);
|
||||
REG_READ(map->dpll);
|
||||
udelay(150);
|
||||
|
||||
REG_WRITE(map->htotal, crtc_state->saveHTOTAL);
|
||||
REG_WRITE(map->hblank, crtc_state->saveHBLANK);
|
||||
REG_WRITE(map->hsync, crtc_state->saveHSYNC);
|
||||
REG_WRITE(map->vtotal, crtc_state->saveVTOTAL);
|
||||
REG_WRITE(map->vblank, crtc_state->saveVBLANK);
|
||||
REG_WRITE(map->vsync, crtc_state->saveVSYNC);
|
||||
REG_WRITE(map->stride, crtc_state->saveDSPSTRIDE);
|
||||
|
||||
REG_WRITE(map->size, crtc_state->saveDSPSIZE);
|
||||
REG_WRITE(map->pos, crtc_state->saveDSPPOS);
|
||||
|
||||
REG_WRITE(map->src, crtc_state->savePIPESRC);
|
||||
REG_WRITE(map->base, crtc_state->saveDSPBASE);
|
||||
REG_WRITE(map->conf, crtc_state->savePIPECONF);
|
||||
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
REG_WRITE(map->cntr, crtc_state->saveDSPCNTR);
|
||||
REG_WRITE(map->base, crtc_state->saveDSPBASE);
|
||||
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
palette_reg = map->palette;
|
||||
for (i = 0; i < 256; ++i)
|
||||
REG_WRITE(palette_reg + (i << 2), crtc_state->savePalette[i]);
|
||||
}
|
||||
|
||||
void gma_encoder_prepare(struct drm_encoder *encoder)
|
||||
{
|
||||
struct drm_encoder_helper_funcs *encoder_funcs =
|
||||
encoder->helper_private;
|
||||
/* lvds has its own version of prepare see psb_intel_lvds_prepare */
|
||||
encoder_funcs->dpms(encoder, DRM_MODE_DPMS_OFF);
|
||||
}
|
||||
|
||||
void gma_encoder_commit(struct drm_encoder *encoder)
|
||||
{
|
||||
struct drm_encoder_helper_funcs *encoder_funcs =
|
||||
encoder->helper_private;
|
||||
/* lvds has its own version of commit see psb_intel_lvds_commit */
|
||||
encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON);
|
||||
}
|
||||
|
||||
void gma_encoder_destroy(struct drm_encoder *encoder)
|
||||
{
|
||||
struct gma_encoder *intel_encoder = to_gma_encoder(encoder);
|
||||
|
||||
drm_encoder_cleanup(encoder);
|
||||
kfree(intel_encoder);
|
||||
}
|
||||
|
||||
/* Currently there is only a 1:1 mapping of encoders and connectors */
|
||||
struct drm_encoder *gma_best_encoder(struct drm_connector *connector)
|
||||
{
|
||||
struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
|
||||
|
||||
return &gma_encoder->base;
|
||||
}
|
||||
|
||||
void gma_connector_attach_encoder(struct gma_connector *connector,
|
||||
struct gma_encoder *encoder)
|
||||
{
|
||||
connector->encoder = encoder;
|
||||
drm_mode_connector_attach_encoder(&connector->base,
|
||||
&encoder->base);
|
||||
}
|
||||
|
||||
#define GMA_PLL_INVALID(s) { /* DRM_ERROR(s); */ return false; }
|
||||
|
||||
bool gma_pll_is_valid(struct drm_crtc *crtc,
|
||||
const struct gma_limit_t *limit,
|
||||
struct gma_clock_t *clock)
|
||||
{
|
||||
if (clock->p1 < limit->p1.min || limit->p1.max < clock->p1)
|
||||
GMA_PLL_INVALID("p1 out of range");
|
||||
if (clock->p < limit->p.min || limit->p.max < clock->p)
|
||||
GMA_PLL_INVALID("p out of range");
|
||||
if (clock->m2 < limit->m2.min || limit->m2.max < clock->m2)
|
||||
GMA_PLL_INVALID("m2 out of range");
|
||||
if (clock->m1 < limit->m1.min || limit->m1.max < clock->m1)
|
||||
GMA_PLL_INVALID("m1 out of range");
|
||||
/* On CDV m1 is always 0 */
|
||||
if (clock->m1 <= clock->m2 && clock->m1 != 0)
|
||||
GMA_PLL_INVALID("m1 <= m2 && m1 != 0");
|
||||
if (clock->m < limit->m.min || limit->m.max < clock->m)
|
||||
GMA_PLL_INVALID("m out of range");
|
||||
if (clock->n < limit->n.min || limit->n.max < clock->n)
|
||||
GMA_PLL_INVALID("n out of range");
|
||||
if (clock->vco < limit->vco.min || limit->vco.max < clock->vco)
|
||||
GMA_PLL_INVALID("vco out of range");
|
||||
/* XXX: We may need to be checking "Dot clock"
|
||||
* depending on the multiplier, connector, etc.,
|
||||
* rather than just a single range.
|
||||
*/
|
||||
if (clock->dot < limit->dot.min || limit->dot.max < clock->dot)
|
||||
GMA_PLL_INVALID("dot out of range");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gma_find_best_pll(const struct gma_limit_t *limit,
|
||||
struct drm_crtc *crtc, int target, int refclk,
|
||||
struct gma_clock_t *best_clock)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
const struct gma_clock_funcs *clock_funcs =
|
||||
to_gma_crtc(crtc)->clock_funcs;
|
||||
struct gma_clock_t clock;
|
||||
int err = target;
|
||||
|
||||
if (gma_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
|
||||
(REG_READ(LVDS) & LVDS_PORT_EN) != 0) {
|
||||
/*
|
||||
* For LVDS, if the panel is on, just rely on its current
|
||||
* settings for dual-channel. We haven't figured out how to
|
||||
* reliably set up different single/dual channel state, if we
|
||||
* even can.
|
||||
*/
|
||||
if ((REG_READ(LVDS) & LVDS_CLKB_POWER_MASK) ==
|
||||
LVDS_CLKB_POWER_UP)
|
||||
clock.p2 = limit->p2.p2_fast;
|
||||
else
|
||||
clock.p2 = limit->p2.p2_slow;
|
||||
} else {
|
||||
if (target < limit->p2.dot_limit)
|
||||
clock.p2 = limit->p2.p2_slow;
|
||||
else
|
||||
clock.p2 = limit->p2.p2_fast;
|
||||
}
|
||||
|
||||
memset(best_clock, 0, sizeof(*best_clock));
|
||||
|
||||
/* m1 is always 0 on CDV so the outmost loop will run just once */
|
||||
for (clock.m1 = limit->m1.min; clock.m1 <= limit->m1.max; clock.m1++) {
|
||||
for (clock.m2 = limit->m2.min;
|
||||
(clock.m2 < clock.m1 || clock.m1 == 0) &&
|
||||
clock.m2 <= limit->m2.max; clock.m2++) {
|
||||
for (clock.n = limit->n.min;
|
||||
clock.n <= limit->n.max; clock.n++) {
|
||||
for (clock.p1 = limit->p1.min;
|
||||
clock.p1 <= limit->p1.max;
|
||||
clock.p1++) {
|
||||
int this_err;
|
||||
|
||||
clock_funcs->clock(refclk, &clock);
|
||||
|
||||
if (!clock_funcs->pll_is_valid(crtc,
|
||||
limit, &clock))
|
||||
continue;
|
||||
|
||||
this_err = abs(clock.dot - target);
|
||||
if (this_err < err) {
|
||||
*best_clock = clock;
|
||||
err = this_err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return err != target;
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright © 2006-2011 Intel Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Authors:
|
||||
* Eric Anholt <eric@anholt.net>
|
||||
* Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef _GMA_DISPLAY_H_
|
||||
#define _GMA_DISPLAY_H_
|
||||
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
struct gma_clock_t {
|
||||
/* given values */
|
||||
int n;
|
||||
int m1, m2;
|
||||
int p1, p2;
|
||||
/* derived values */
|
||||
int dot;
|
||||
int vco;
|
||||
int m;
|
||||
int p;
|
||||
};
|
||||
|
||||
struct gma_range_t {
|
||||
int min, max;
|
||||
};
|
||||
|
||||
struct gma_p2_t {
|
||||
int dot_limit;
|
||||
int p2_slow, p2_fast;
|
||||
};
|
||||
|
||||
struct gma_limit_t {
|
||||
struct gma_range_t dot, vco, n, m, m1, m2, p, p1;
|
||||
struct gma_p2_t p2;
|
||||
bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *,
|
||||
int target, int refclk,
|
||||
struct gma_clock_t *best_clock);
|
||||
};
|
||||
|
||||
struct gma_clock_funcs {
|
||||
void (*clock)(int refclk, struct gma_clock_t *clock);
|
||||
const struct gma_limit_t *(*limit)(struct drm_crtc *crtc, int refclk);
|
||||
bool (*pll_is_valid)(struct drm_crtc *crtc,
|
||||
const struct gma_limit_t *limit,
|
||||
struct gma_clock_t *clock);
|
||||
};
|
||||
|
||||
/* Common pipe related functions */
|
||||
extern bool gma_pipe_has_type(struct drm_crtc *crtc, int type);
|
||||
extern void gma_wait_for_vblank(struct drm_device *dev);
|
||||
extern int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
|
||||
struct drm_framebuffer *old_fb);
|
||||
extern int gma_crtc_cursor_set(struct drm_crtc *crtc,
|
||||
struct drm_file *file_priv,
|
||||
uint32_t handle,
|
||||
uint32_t width, uint32_t height);
|
||||
extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
|
||||
extern void gma_crtc_load_lut(struct drm_crtc *crtc);
|
||||
extern void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
|
||||
u16 *blue, u32 start, u32 size);
|
||||
extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
|
||||
extern bool gma_crtc_mode_fixup(struct drm_crtc *crtc,
|
||||
const struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode);
|
||||
extern void gma_crtc_prepare(struct drm_crtc *crtc);
|
||||
extern void gma_crtc_commit(struct drm_crtc *crtc);
|
||||
extern void gma_crtc_disable(struct drm_crtc *crtc);
|
||||
extern void gma_crtc_destroy(struct drm_crtc *crtc);
|
||||
extern int gma_crtc_set_config(struct drm_mode_set *set);
|
||||
|
||||
extern void gma_crtc_save(struct drm_crtc *crtc);
|
||||
extern void gma_crtc_restore(struct drm_crtc *crtc);
|
||||
|
||||
extern void gma_encoder_prepare(struct drm_encoder *encoder);
|
||||
extern void gma_encoder_commit(struct drm_encoder *encoder);
|
||||
extern void gma_encoder_destroy(struct drm_encoder *encoder);
|
||||
|
||||
/* Common clock related functions */
|
||||
extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
|
||||
extern void gma_clock(int refclk, struct gma_clock_t *clock);
|
||||
extern bool gma_pll_is_valid(struct drm_crtc *crtc,
|
||||
const struct gma_limit_t *limit,
|
||||
struct gma_clock_t *clock);
|
||||
extern bool gma_find_best_pll(const struct gma_limit_t *limit,
|
||||
struct drm_crtc *crtc, int target, int refclk,
|
||||
struct gma_clock_t *best_clock);
|
||||
#endif
|
|
@ -249,12 +249,11 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
|
|||
struct drm_encoder *encoder = connector->encoder;
|
||||
|
||||
if (!strcmp(property->name, "scaling mode") && encoder) {
|
||||
struct psb_intel_crtc *psb_crtc =
|
||||
to_psb_intel_crtc(encoder->crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc);
|
||||
bool centerechange;
|
||||
uint64_t val;
|
||||
|
||||
if (!psb_crtc)
|
||||
if (!gma_crtc)
|
||||
goto set_prop_error;
|
||||
|
||||
switch (value) {
|
||||
|
@ -281,11 +280,11 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
|
|||
centerechange = (val == DRM_MODE_SCALE_NO_SCALE) ||
|
||||
(value == DRM_MODE_SCALE_NO_SCALE);
|
||||
|
||||
if (psb_crtc->saved_mode.hdisplay != 0 &&
|
||||
psb_crtc->saved_mode.vdisplay != 0) {
|
||||
if (gma_crtc->saved_mode.hdisplay != 0 &&
|
||||
gma_crtc->saved_mode.vdisplay != 0) {
|
||||
if (centerechange) {
|
||||
if (!drm_crtc_helper_set_mode(encoder->crtc,
|
||||
&psb_crtc->saved_mode,
|
||||
&gma_crtc->saved_mode,
|
||||
encoder->crtc->x,
|
||||
encoder->crtc->y,
|
||||
encoder->crtc->fb))
|
||||
|
@ -294,8 +293,8 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
|
|||
struct drm_encoder_helper_funcs *funcs =
|
||||
encoder->helper_private;
|
||||
funcs->mode_set(encoder,
|
||||
&psb_crtc->saved_mode,
|
||||
&psb_crtc->saved_adjusted_mode);
|
||||
&gma_crtc->saved_mode,
|
||||
&gma_crtc->saved_adjusted_mode);
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(property->name, "backlight") && encoder) {
|
||||
|
|
|
@ -227,7 +227,7 @@ enum {
|
|||
#define DSI_DPI_DISABLE_BTA BIT(3)
|
||||
|
||||
struct mdfld_dsi_connector {
|
||||
struct psb_intel_connector base;
|
||||
struct gma_connector base;
|
||||
|
||||
int pipe;
|
||||
void *private;
|
||||
|
@ -238,7 +238,7 @@ struct mdfld_dsi_connector {
|
|||
};
|
||||
|
||||
struct mdfld_dsi_encoder {
|
||||
struct psb_intel_encoder base;
|
||||
struct gma_encoder base;
|
||||
void *private;
|
||||
};
|
||||
|
||||
|
@ -269,21 +269,21 @@ struct mdfld_dsi_config {
|
|||
static inline struct mdfld_dsi_connector *mdfld_dsi_connector(
|
||||
struct drm_connector *connector)
|
||||
{
|
||||
struct psb_intel_connector *psb_connector;
|
||||
struct gma_connector *gma_connector;
|
||||
|
||||
psb_connector = to_psb_intel_connector(connector);
|
||||
gma_connector = to_gma_connector(connector);
|
||||
|
||||
return container_of(psb_connector, struct mdfld_dsi_connector, base);
|
||||
return container_of(gma_connector, struct mdfld_dsi_connector, base);
|
||||
}
|
||||
|
||||
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 *
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <drm/drmP.h>
|
||||
#include "psb_intel_reg.h"
|
||||
#include "psb_intel_display.h"
|
||||
#include "gma_display.h"
|
||||
#include "framebuffer.h"
|
||||
#include "mdfld_output.h"
|
||||
#include "mdfld_dsi_output.h"
|
||||
|
@ -65,7 +65,7 @@ void mdfldWaitForPipeDisable(struct drm_device *dev, int pipe)
|
|||
}
|
||||
|
||||
/* FIXME JLIU7_PO */
|
||||
psb_intel_wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
return;
|
||||
|
||||
/* Wait for for the pipe disable to take effect. */
|
||||
|
@ -93,7 +93,7 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe)
|
|||
}
|
||||
|
||||
/* FIXME JLIU7_PO */
|
||||
psb_intel_wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
return;
|
||||
|
||||
/* Wait for for the pipe enable to take effect. */
|
||||
|
@ -104,25 +104,6 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe)
|
|||
}
|
||||
}
|
||||
|
||||
static void psb_intel_crtc_prepare(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
|
||||
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
|
||||
}
|
||||
|
||||
static void psb_intel_crtc_commit(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
|
||||
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON);
|
||||
}
|
||||
|
||||
static bool psb_intel_crtc_mode_fixup(struct drm_crtc *crtc,
|
||||
const struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the pipe currently connected to the panel fitter,
|
||||
* or -1 if the panel fitter is not present or not in use
|
||||
|
@ -184,9 +165,9 @@ static int mdfld__intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
|
|||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
|
||||
int pipe = psb_intel_crtc->pipe;
|
||||
int pipe = gma_crtc->pipe;
|
||||
const struct psb_offset *map = &dev_priv->regmap[pipe];
|
||||
unsigned long start, offset;
|
||||
u32 dspcntr;
|
||||
|
@ -324,8 +305,8 @@ static void mdfld_crtc_dpms(struct drm_crtc *crtc, int mode)
|
|||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
|
||||
int pipe = psb_intel_crtc->pipe;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
int pipe = gma_crtc->pipe;
|
||||
const struct psb_offset *map = &dev_priv->regmap[pipe];
|
||||
u32 pipeconf = dev_priv->pipeconf[pipe];
|
||||
u32 temp;
|
||||
|
@ -436,7 +417,7 @@ static void mdfld_crtc_dpms(struct drm_crtc *crtc, int mode)
|
|||
}
|
||||
}
|
||||
|
||||
psb_intel_crtc_load_lut(crtc);
|
||||
gma_crtc_load_lut(crtc);
|
||||
|
||||
/* Give the overlay scaler a chance to enable
|
||||
if it's on this pipe */
|
||||
|
@ -611,8 +592,8 @@ static const struct mrst_limit_t *mdfld_limit(struct drm_crtc *crtc)
|
|||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
|
||||
if (psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_MIPI)
|
||||
|| psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_MIPI2)) {
|
||||
if (gma_pipe_has_type(crtc, INTEL_OUTPUT_MIPI)
|
||||
|| gma_pipe_has_type(crtc, INTEL_OUTPUT_MIPI2)) {
|
||||
if ((ksel == KSEL_CRYSTAL_19) || (ksel == KSEL_BYPASS_19))
|
||||
limit = &mdfld_limits[MDFLD_LIMT_DSIPLL_19];
|
||||
else if (ksel == KSEL_BYPASS_25)
|
||||
|
@ -624,7 +605,7 @@ static const struct mrst_limit_t *mdfld_limit(struct drm_crtc *crtc)
|
|||
(dev_priv->core_freq == 100 ||
|
||||
dev_priv->core_freq == 200))
|
||||
limit = &mdfld_limits[MDFLD_LIMT_DSIPLL_100];
|
||||
} else if (psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI)) {
|
||||
} else if (gma_pipe_has_type(crtc, INTEL_OUTPUT_HDMI)) {
|
||||
if ((ksel == KSEL_CRYSTAL_19) || (ksel == KSEL_BYPASS_19))
|
||||
limit = &mdfld_limits[MDFLD_LIMT_DPLL_19];
|
||||
else if (ksel == KSEL_BYPASS_25)
|
||||
|
@ -688,9 +669,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
|
|||
struct drm_framebuffer *old_fb)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
int pipe = psb_intel_crtc->pipe;
|
||||
int pipe = gma_crtc->pipe;
|
||||
const struct psb_offset *map = &dev_priv->regmap[pipe];
|
||||
int refclk = 0;
|
||||
int clk_n = 0, clk_p2 = 0, clk_byte = 1, clk = 0, m_conv = 0,
|
||||
|
@ -700,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;
|
||||
|
@ -749,9 +730,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
|
|||
if (!gma_power_begin(dev, true))
|
||||
return 0;
|
||||
|
||||
memcpy(&psb_intel_crtc->saved_mode, mode,
|
||||
memcpy(&gma_crtc->saved_mode, mode,
|
||||
sizeof(struct drm_display_mode));
|
||||
memcpy(&psb_intel_crtc->saved_adjusted_mode, adjusted_mode,
|
||||
memcpy(&gma_crtc->saved_adjusted_mode, adjusted_mode,
|
||||
sizeof(struct drm_display_mode));
|
||||
|
||||
list_for_each_entry(connector, &mode_config->connector_list, head) {
|
||||
|
@ -766,9 +747,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
|
|||
if (encoder->crtc != crtc)
|
||||
continue;
|
||||
|
||||
psb_intel_encoder = psb_intel_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;
|
||||
|
@ -819,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);
|
||||
|
||||
|
@ -1034,7 +1015,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
|
|||
|
||||
/* Wait for for the pipe enable to take effect. */
|
||||
REG_WRITE(map->cntr, dev_priv->dspcntr[pipe]);
|
||||
psb_intel_wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
mrst_crtc_mode_set_exit:
|
||||
|
||||
|
@ -1045,10 +1026,10 @@ mrst_crtc_mode_set_exit:
|
|||
|
||||
const struct drm_crtc_helper_funcs mdfld_helper_funcs = {
|
||||
.dpms = mdfld_crtc_dpms,
|
||||
.mode_fixup = psb_intel_crtc_mode_fixup,
|
||||
.mode_fixup = gma_crtc_mode_fixup,
|
||||
.mode_set = mdfld_crtc_mode_set,
|
||||
.mode_set_base = mdfld__intel_pipe_set_base,
|
||||
.prepare = psb_intel_crtc_prepare,
|
||||
.commit = psb_intel_crtc_commit,
|
||||
.prepare = gma_crtc_prepare,
|
||||
.commit = gma_crtc_commit,
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "psb_drv.h"
|
||||
#include "psb_intel_drv.h"
|
||||
#include "psb_intel_reg.h"
|
||||
#include "psb_intel_display.h"
|
||||
#include "gma_display.h"
|
||||
#include "power.h"
|
||||
|
||||
struct psb_intel_range_t {
|
||||
|
@ -88,8 +88,8 @@ static const struct oaktrail_limit_t *oaktrail_limit(struct drm_crtc *crtc)
|
|||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
|
||||
if (psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)
|
||||
|| psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_MIPI)) {
|
||||
if (gma_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)
|
||||
|| gma_pipe_has_type(crtc, INTEL_OUTPUT_MIPI)) {
|
||||
switch (dev_priv->core_freq) {
|
||||
case 100:
|
||||
limit = &oaktrail_limits[MRST_LIMIT_LVDS_100L];
|
||||
|
@ -163,8 +163,8 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode)
|
|||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
|
||||
int pipe = psb_intel_crtc->pipe;
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
int pipe = gma_crtc->pipe;
|
||||
const struct psb_offset *map = &dev_priv->regmap[pipe];
|
||||
u32 temp;
|
||||
|
||||
|
@ -212,7 +212,7 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode)
|
|||
REG_WRITE(map->base, REG_READ(map->base));
|
||||
}
|
||||
|
||||
psb_intel_crtc_load_lut(crtc);
|
||||
gma_crtc_load_lut(crtc);
|
||||
|
||||
/* Give the overlay scaler a chance to enable
|
||||
if it's on this pipe */
|
||||
|
@ -242,7 +242,7 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode)
|
|||
REG_READ(map->conf);
|
||||
}
|
||||
/* Wait for for the pipe disable to take effect. */
|
||||
psb_intel_wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
temp = REG_READ(map->dpll);
|
||||
if ((temp & DPLL_VCO_ENABLE) != 0) {
|
||||
|
@ -292,9 +292,9 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
|
|||
struct drm_framebuffer *old_fb)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
int pipe = psb_intel_crtc->pipe;
|
||||
int pipe = gma_crtc->pipe;
|
||||
const struct psb_offset *map = &dev_priv->regmap[pipe];
|
||||
int refclk = 0;
|
||||
struct oaktrail_clock_t clock;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -313,10 +313,10 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
|
|||
if (!gma_power_begin(dev, true))
|
||||
return 0;
|
||||
|
||||
memcpy(&psb_intel_crtc->saved_mode,
|
||||
memcpy(&gma_crtc->saved_mode,
|
||||
mode,
|
||||
sizeof(struct drm_display_mode));
|
||||
memcpy(&psb_intel_crtc->saved_adjusted_mode,
|
||||
memcpy(&gma_crtc->saved_adjusted_mode,
|
||||
adjusted_mode,
|
||||
sizeof(struct drm_display_mode));
|
||||
|
||||
|
@ -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 = psb_intel_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);
|
||||
|
||||
|
@ -484,31 +484,24 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
|
|||
|
||||
REG_WRITE(map->conf, pipeconf);
|
||||
REG_READ(map->conf);
|
||||
psb_intel_wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
REG_WRITE(map->cntr, dspcntr);
|
||||
psb_intel_wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
oaktrail_crtc_mode_set_exit:
|
||||
gma_power_end(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool oaktrail_crtc_mode_fixup(struct drm_crtc *crtc,
|
||||
const struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static int oaktrail_pipe_set_base(struct drm_crtc *crtc,
|
||||
int x, int y, struct drm_framebuffer *old_fb)
|
||||
{
|
||||
struct drm_device *dev = crtc->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
|
||||
int pipe = psb_intel_crtc->pipe;
|
||||
int pipe = gma_crtc->pipe;
|
||||
const struct psb_offset *map = &dev_priv->regmap[pipe];
|
||||
unsigned long start, offset;
|
||||
|
||||
|
@ -563,24 +556,12 @@ pipe_set_base_exit:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void oaktrail_crtc_prepare(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
|
||||
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
|
||||
}
|
||||
|
||||
static void oaktrail_crtc_commit(struct drm_crtc *crtc)
|
||||
{
|
||||
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
|
||||
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON);
|
||||
}
|
||||
|
||||
const struct drm_crtc_helper_funcs oaktrail_helper_funcs = {
|
||||
.dpms = oaktrail_crtc_dpms,
|
||||
.mode_fixup = oaktrail_crtc_mode_fixup,
|
||||
.mode_fixup = gma_crtc_mode_fixup,
|
||||
.mode_set = oaktrail_crtc_mode_set,
|
||||
.mode_set_base = oaktrail_pipe_set_base,
|
||||
.prepare = oaktrail_crtc_prepare,
|
||||
.commit = oaktrail_crtc_commit,
|
||||
.prepare = gma_crtc_prepare,
|
||||
.commit = gma_crtc_commit,
|
||||
};
|
||||
|
||||
|
|
|
@ -155,12 +155,6 @@ static void oaktrail_hdmi_audio_disable(struct drm_device *dev)
|
|||
HDMI_READ(HDMI_HCR);
|
||||
}
|
||||
|
||||
static void wait_for_vblank(struct drm_device *dev)
|
||||
{
|
||||
/* Wait for 20ms, i.e. one cycle at 50hz. */
|
||||
mdelay(20);
|
||||
}
|
||||
|
||||
static unsigned int htotal_calculate(struct drm_display_mode *mode)
|
||||
{
|
||||
u32 htotal, new_crtc_htotal;
|
||||
|
@ -372,10 +366,10 @@ int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc,
|
|||
|
||||
REG_WRITE(PCH_PIPEBCONF, pipeconf);
|
||||
REG_READ(PCH_PIPEBCONF);
|
||||
wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
REG_WRITE(dspcntr_reg, dspcntr);
|
||||
wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
gma_power_end(dev);
|
||||
|
||||
|
@ -459,7 +453,7 @@ void oaktrail_crtc_hdmi_dpms(struct drm_crtc *crtc, int mode)
|
|||
REG_READ(PCH_PIPEBCONF);
|
||||
}
|
||||
|
||||
wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
/* Enable plane */
|
||||
temp = REG_READ(DSPBCNTR);
|
||||
|
@ -470,7 +464,7 @@ void oaktrail_crtc_hdmi_dpms(struct drm_crtc *crtc, int mode)
|
|||
REG_READ(DSPBSURF);
|
||||
}
|
||||
|
||||
psb_intel_crtc_load_lut(crtc);
|
||||
gma_crtc_load_lut(crtc);
|
||||
}
|
||||
|
||||
/* DSPARB */
|
||||
|
@ -615,16 +609,16 @@ static void oaktrail_hdmi_destroy(struct drm_connector *connector)
|
|||
static const struct drm_encoder_helper_funcs oaktrail_hdmi_helper_funcs = {
|
||||
.dpms = oaktrail_hdmi_dpms,
|
||||
.mode_fixup = oaktrail_hdmi_mode_fixup,
|
||||
.prepare = psb_intel_encoder_prepare,
|
||||
.prepare = gma_encoder_prepare,
|
||||
.mode_set = oaktrail_hdmi_mode_set,
|
||||
.commit = psb_intel_encoder_commit,
|
||||
.commit = gma_encoder_commit,
|
||||
};
|
||||
|
||||
static const struct drm_connector_helper_funcs
|
||||
oaktrail_hdmi_connector_helper_funcs = {
|
||||
.get_modes = oaktrail_hdmi_get_modes,
|
||||
.mode_valid = oaktrail_hdmi_mode_valid,
|
||||
.best_encoder = psb_intel_best_encoder,
|
||||
.best_encoder = gma_best_encoder,
|
||||
};
|
||||
|
||||
static const struct drm_connector_funcs oaktrail_hdmi_connector_funcs = {
|
||||
|
@ -646,21 +640,21 @@ 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 psb_intel_connector *psb_intel_connector;
|
||||
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;
|
||||
|
||||
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL);
|
||||
if (!psb_intel_connector)
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
|
||||
if (!gma_connector)
|
||||
goto failed_connector;
|
||||
|
||||
connector = &psb_intel_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
connector = &gma_connector->base;
|
||||
encoder = &gma_encoder->base;
|
||||
drm_connector_init(dev, connector,
|
||||
&oaktrail_hdmi_connector_funcs,
|
||||
DRM_MODE_CONNECTOR_DVID);
|
||||
|
@ -669,10 +663,9 @@ void oaktrail_hdmi_init(struct drm_device *dev,
|
|||
&oaktrail_hdmi_enc_funcs,
|
||||
DRM_MODE_ENCODER_TMDS);
|
||||
|
||||
psb_intel_connector_attach_encoder(psb_intel_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);
|
||||
|
||||
|
@ -685,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,8 +322,8 @@ 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 psb_intel_connector *psb_intel_connector;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
|
@ -334,16 +331,16 @@ 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;
|
||||
|
||||
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL);
|
||||
if (!psb_intel_connector)
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
|
||||
if (!gma_connector)
|
||||
goto failed_connector;
|
||||
|
||||
connector = &psb_intel_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
connector = &gma_connector->base;
|
||||
encoder = &gma_encoder->base;
|
||||
dev_priv->is_lvds_on = true;
|
||||
drm_connector_init(dev, connector,
|
||||
&psb_intel_lvds_connector_funcs,
|
||||
|
@ -352,9 +349,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
|
|||
drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
|
||||
DRM_MODE_ENCODER_LVDS);
|
||||
|
||||
psb_intel_connector_attach_encoder(psb_intel_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,
|
||||
|
@ -434,15 +430,15 @@ 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: */
|
||||
|
||||
drm_encoder_cleanup(encoder);
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(psb_intel_connector);
|
||||
kfree(gma_connector);
|
||||
failed_connector:
|
||||
kfree(psb_intel_encoder);
|
||||
kfree(gma_encoder);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "psb_reg.h"
|
||||
#include "psb_intel_reg.h"
|
||||
#include "intel_bios.h"
|
||||
|
||||
#include "psb_device.h"
|
||||
|
||||
static int psb_output_init(struct drm_device *dev)
|
||||
{
|
||||
|
@ -380,6 +380,7 @@ const struct psb_ops psb_chip_ops = {
|
|||
|
||||
.crtc_helper = &psb_intel_helper_funcs,
|
||||
.crtc_funcs = &psb_intel_crtc_funcs,
|
||||
.clock_funcs = &psb_clock_funcs,
|
||||
|
||||
.output_init = psb_output_init,
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
/* copyright (c) 2008, Intel Corporation
|
||||
/*
|
||||
* Copyright © 2013 Patrik Jakobsson
|
||||
* Copyright © 2011 Intel Corporation
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
@ -12,14 +14,11 @@
|
|||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Authors:
|
||||
* Eric Anholt <eric@anholt.net>
|
||||
*/
|
||||
|
||||
#ifndef _INTEL_DISPLAY_H_
|
||||
#define _INTEL_DISPLAY_H_
|
||||
#ifndef _PSB_DEVICE_H_
|
||||
#define _PSB_DEVICE_H_
|
||||
|
||||
bool psb_intel_pipe_has_type(struct drm_crtc *crtc, int type);
|
||||
extern const struct gma_clock_funcs psb_clock_funcs;
|
||||
|
||||
#endif
|
|
@ -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 = psb_intel_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);
|
||||
|
@ -441,7 +441,7 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,
|
|||
struct drm_mode_object *obj;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_connector *connector;
|
||||
struct psb_intel_crtc *psb_intel_crtc;
|
||||
struct gma_crtc *gma_crtc;
|
||||
int i = 0;
|
||||
int32_t obj_id;
|
||||
|
||||
|
@ -454,12 +454,12 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,
|
|||
|
||||
connector = obj_to_connector(obj);
|
||||
crtc = connector->encoder->crtc;
|
||||
psb_intel_crtc = to_psb_intel_crtc(crtc);
|
||||
gma_crtc = to_gma_crtc(crtc);
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
psb_intel_crtc->lut_adj[i] = lut_arg->lut[i];
|
||||
gma_crtc->lut_adj[i] = lut_arg->lut[i];
|
||||
|
||||
psb_intel_crtc_load_lut(crtc);
|
||||
gma_crtc_load_lut(crtc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <drm/gma_drm.h>
|
||||
#include "psb_reg.h"
|
||||
#include "psb_intel_drv.h"
|
||||
#include "gma_display.h"
|
||||
#include "intel_bios.h"
|
||||
#include "gtt.h"
|
||||
#include "power.h"
|
||||
|
@ -46,6 +47,7 @@ enum {
|
|||
#define IS_PSB(dev) (((dev)->pci_device & 0xfffe) == 0x8108)
|
||||
#define IS_MRST(dev) (((dev)->pci_device & 0xfffc) == 0x4100)
|
||||
#define IS_MFLD(dev) (((dev)->pci_device & 0xfff8) == 0x0130)
|
||||
#define IS_CDV(dev) (((dev)->pci_device & 0xfff0) == 0x0be0)
|
||||
|
||||
/*
|
||||
* Driver definitions
|
||||
|
@ -675,6 +677,7 @@ struct psb_ops {
|
|||
/* Sub functions */
|
||||
struct drm_crtc_helper_funcs const *crtc_helper;
|
||||
struct drm_crtc_funcs const *crtc_funcs;
|
||||
const struct gma_clock_funcs *clock_funcs;
|
||||
|
||||
/* Setup hooks */
|
||||
int (*chip_setup)(struct drm_device *dev);
|
||||
|
@ -692,6 +695,8 @@ struct psb_ops {
|
|||
int (*restore_regs)(struct drm_device *dev);
|
||||
int (*power_up)(struct drm_device *dev);
|
||||
int (*power_down)(struct drm_device *dev);
|
||||
void (*update_wm)(struct drm_device *dev, struct drm_crtc *crtc);
|
||||
void (*disable_sr)(struct drm_device *dev);
|
||||
|
||||
void (*lvds_bl_power)(struct drm_device *dev, bool on);
|
||||
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,6 +24,7 @@
|
|||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_crtc_helper.h>
|
||||
#include <linux/gpio.h>
|
||||
#include "gma_display.h"
|
||||
|
||||
/*
|
||||
* Display related stuff
|
||||
|
@ -116,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 */
|
||||
|
@ -136,9 +137,9 @@ struct psb_intel_encoder {
|
|||
struct psb_intel_i2c_chan *ddc_bus;
|
||||
};
|
||||
|
||||
struct psb_intel_connector {
|
||||
struct gma_connector {
|
||||
struct drm_connector base;
|
||||
struct psb_intel_encoder *encoder;
|
||||
struct gma_encoder *encoder;
|
||||
};
|
||||
|
||||
struct psb_intel_crtc_state {
|
||||
|
@ -161,7 +162,7 @@ struct psb_intel_crtc_state {
|
|||
uint32_t savePalette[256];
|
||||
};
|
||||
|
||||
struct psb_intel_crtc {
|
||||
struct gma_crtc {
|
||||
struct drm_crtc base;
|
||||
int pipe;
|
||||
int plane;
|
||||
|
@ -188,14 +189,16 @@ struct psb_intel_crtc {
|
|||
|
||||
/* Saved Crtc HW states */
|
||||
struct psb_intel_crtc_state *crtc_state;
|
||||
|
||||
const struct gma_clock_funcs *clock_funcs;
|
||||
};
|
||||
|
||||
#define to_psb_intel_crtc(x) \
|
||||
container_of(x, struct psb_intel_crtc, base)
|
||||
#define to_psb_intel_connector(x) \
|
||||
container_of(x, struct psb_intel_connector, base)
|
||||
#define to_psb_intel_encoder(x) \
|
||||
container_of(x, struct psb_intel_encoder, base)
|
||||
#define to_gma_crtc(x) \
|
||||
container_of(x, struct gma_crtc, base)
|
||||
#define to_gma_connector(x) \
|
||||
container_of(x, struct gma_connector, 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)
|
||||
|
||||
|
@ -223,27 +226,18 @@ extern void oaktrail_dsi_init(struct drm_device *dev,
|
|||
extern void mid_dsi_init(struct drm_device *dev,
|
||||
struct psb_intel_mode_device *mode_dev, int dsi_num);
|
||||
|
||||
extern void psb_intel_crtc_load_lut(struct drm_crtc *crtc);
|
||||
extern void psb_intel_encoder_prepare(struct drm_encoder *encoder);
|
||||
extern void psb_intel_encoder_commit(struct drm_encoder *encoder);
|
||||
extern void psb_intel_encoder_destroy(struct drm_encoder *encoder);
|
||||
extern struct drm_encoder *gma_best_encoder(struct drm_connector *connector);
|
||||
extern void gma_connector_attach_encoder(struct gma_connector *connector,
|
||||
struct gma_encoder *encoder);
|
||||
|
||||
static inline struct psb_intel_encoder *psb_intel_attached_encoder(
|
||||
static inline struct gma_encoder *gma_attached_encoder(
|
||||
struct drm_connector *connector)
|
||||
{
|
||||
return to_psb_intel_connector(connector)->encoder;
|
||||
return to_gma_connector(connector)->encoder;
|
||||
}
|
||||
|
||||
extern void psb_intel_connector_attach_encoder(
|
||||
struct psb_intel_connector *connector,
|
||||
struct psb_intel_encoder *encoder);
|
||||
|
||||
extern struct drm_encoder *psb_intel_best_encoder(struct drm_connector
|
||||
*connector);
|
||||
|
||||
extern struct drm_display_mode *psb_intel_crtc_mode_get(struct drm_device *dev,
|
||||
struct drm_crtc *crtc);
|
||||
extern void psb_intel_wait_for_vblank(struct drm_device *dev);
|
||||
extern int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv);
|
||||
extern struct drm_crtc *psb_intel_get_crtc_from_pipe(struct drm_device *dev,
|
||||
|
|
|
@ -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 =
|
||||
psb_intel_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 =
|
||||
psb_intel_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 =
|
||||
psb_intel_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 */
|
||||
|
@ -381,22 +378,20 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
|
|||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_psb_private *dev_priv = dev->dev_private;
|
||||
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
|
||||
struct psb_intel_crtc *psb_intel_crtc =
|
||||
to_psb_intel_crtc(encoder->crtc);
|
||||
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 */
|
||||
if (!IS_MRST(dev) && psb_intel_crtc->pipe == 0) {
|
||||
if (!IS_MRST(dev) && gma_crtc->pipe == 0) {
|
||||
printk(KERN_ERR "Can't support LVDS on pipe A\n");
|
||||
return false;
|
||||
}
|
||||
if (IS_MRST(dev) && psb_intel_crtc->pipe != 0) {
|
||||
if (IS_MRST(dev) && gma_crtc->pipe != 0) {
|
||||
printk(KERN_ERR "Must use PIPE A\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -525,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 =
|
||||
psb_intel_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))
|
||||
|
@ -564,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 =
|
||||
psb_intel_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);
|
||||
|
@ -585,8 +578,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
|
|||
return -1;
|
||||
|
||||
if (!strcmp(property->name, "scaling mode")) {
|
||||
struct psb_intel_crtc *crtc =
|
||||
to_psb_intel_crtc(encoder->crtc);
|
||||
struct gma_crtc *crtc = to_gma_crtc(encoder->crtc);
|
||||
uint64_t curval;
|
||||
|
||||
if (!crtc)
|
||||
|
@ -656,7 +648,7 @@ const struct drm_connector_helper_funcs
|
|||
psb_intel_lvds_connector_helper_funcs = {
|
||||
.get_modes = psb_intel_lvds_get_modes,
|
||||
.mode_valid = psb_intel_lvds_mode_valid,
|
||||
.best_encoder = psb_intel_best_encoder,
|
||||
.best_encoder = gma_best_encoder,
|
||||
};
|
||||
|
||||
const struct drm_connector_funcs psb_intel_lvds_connector_funcs = {
|
||||
|
@ -691,8 +683,8 @@ 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 psb_intel_connector *psb_intel_connector;
|
||||
struct gma_encoder *gma_encoder;
|
||||
struct gma_connector *gma_connector;
|
||||
struct psb_intel_lvds_priv *lvds_priv;
|
||||
struct drm_connector *connector;
|
||||
struct drm_encoder *encoder;
|
||||
|
@ -702,17 +694,15 @@ 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;
|
||||
}
|
||||
|
||||
psb_intel_connector =
|
||||
kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL);
|
||||
if (!psb_intel_connector) {
|
||||
dev_err(dev->dev, "psb_intel_connector allocation error\n");
|
||||
gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
|
||||
if (!gma_connector) {
|
||||
dev_err(dev->dev, "gma_connector allocation error\n");
|
||||
goto failed_encoder;
|
||||
}
|
||||
|
||||
|
@ -722,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 = &psb_intel_connector->base;
|
||||
encoder = &psb_intel_encoder->base;
|
||||
connector = &gma_connector->base;
|
||||
encoder = &gma_encoder->base;
|
||||
drm_connector_init(dev, connector,
|
||||
&psb_intel_lvds_connector_funcs,
|
||||
DRM_MODE_CONNECTOR_LVDS);
|
||||
|
@ -734,9 +724,8 @@ void psb_intel_lvds_init(struct drm_device *dev,
|
|||
&psb_intel_lvds_enc_funcs,
|
||||
DRM_MODE_ENCODER_LVDS);
|
||||
|
||||
psb_intel_connector_attach_encoder(psb_intel_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,
|
||||
|
@ -851,8 +840,8 @@ failed_blc_i2c:
|
|||
drm_encoder_cleanup(encoder);
|
||||
drm_connector_cleanup(connector);
|
||||
failed_connector:
|
||||
kfree(psb_intel_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;
|
||||
|
@ -140,7 +140,7 @@ struct psb_intel_sdvo {
|
|||
};
|
||||
|
||||
struct psb_intel_sdvo_connector {
|
||||
struct psb_intel_connector base;
|
||||
struct gma_connector base;
|
||||
|
||||
/* Mark the type of connector */
|
||||
uint16_t output_flag;
|
||||
|
@ -200,13 +200,13 @@ static struct psb_intel_sdvo *to_psb_intel_sdvo(struct drm_encoder *encoder)
|
|||
|
||||
static struct psb_intel_sdvo *intel_attached_sdvo(struct drm_connector *connector)
|
||||
{
|
||||
return container_of(psb_intel_attached_encoder(connector),
|
||||
return container_of(gma_attached_encoder(connector),
|
||||
struct psb_intel_sdvo, base);
|
||||
}
|
||||
|
||||
static struct psb_intel_sdvo_connector *to_psb_intel_sdvo_connector(struct drm_connector *connector)
|
||||
{
|
||||
return container_of(to_psb_intel_connector(connector), struct psb_intel_sdvo_connector, base);
|
||||
return container_of(to_gma_connector(connector), struct psb_intel_sdvo_connector, base);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -987,7 +987,7 @@ static void psb_intel_sdvo_mode_set(struct drm_encoder *encoder,
|
|||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_crtc *crtc = encoder->crtc;
|
||||
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
|
||||
struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
|
||||
struct psb_intel_sdvo *psb_intel_sdvo = to_psb_intel_sdvo(encoder);
|
||||
u32 sdvox;
|
||||
struct psb_intel_sdvo_in_out_map in_out;
|
||||
|
@ -1070,7 +1070,7 @@ static void psb_intel_sdvo_mode_set(struct drm_encoder *encoder,
|
|||
}
|
||||
sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
|
||||
|
||||
if (psb_intel_crtc->pipe == 1)
|
||||
if (gma_crtc->pipe == 1)
|
||||
sdvox |= SDVO_PIPE_B_SELECT;
|
||||
if (psb_intel_sdvo->has_hdmi_audio)
|
||||
sdvox |= SDVO_AUDIO_ENABLE;
|
||||
|
@ -1121,7 +1121,7 @@ static void psb_intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
|
|||
if ((temp & SDVO_ENABLE) == 0)
|
||||
psb_intel_sdvo_write_sdvox(psb_intel_sdvo, temp | SDVO_ENABLE);
|
||||
for (i = 0; i < 2; i++)
|
||||
psb_intel_wait_for_vblank(dev);
|
||||
gma_wait_for_vblank(dev);
|
||||
|
||||
status = psb_intel_sdvo_get_trained_inputs(psb_intel_sdvo, &input1, &input2);
|
||||
/* Warn if the device reported failure to sync.
|
||||
|
@ -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 =
|
||||
psb_intel_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);
|
||||
}
|
||||
|
@ -1847,8 +1845,7 @@ static void psb_intel_sdvo_save(struct drm_connector *connector)
|
|||
static void psb_intel_sdvo_restore(struct drm_connector *connector)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_encoder *encoder =
|
||||
&psb_intel_attached_encoder(connector)->base;
|
||||
struct drm_encoder *encoder = &gma_attached_encoder(connector)->base;
|
||||
struct psb_intel_sdvo *sdvo = to_psb_intel_sdvo(encoder);
|
||||
struct drm_crtc *crtc = encoder->crtc;
|
||||
|
||||
|
@ -1864,9 +1861,9 @@ static void psb_intel_sdvo_restore(struct drm_connector *connector)
|
|||
static const struct drm_encoder_helper_funcs psb_intel_sdvo_helper_funcs = {
|
||||
.dpms = psb_intel_sdvo_dpms,
|
||||
.mode_fixup = psb_intel_sdvo_mode_fixup,
|
||||
.prepare = psb_intel_encoder_prepare,
|
||||
.prepare = gma_encoder_prepare,
|
||||
.mode_set = psb_intel_sdvo_mode_set,
|
||||
.commit = psb_intel_encoder_commit,
|
||||
.commit = gma_encoder_commit,
|
||||
};
|
||||
|
||||
static const struct drm_connector_funcs psb_intel_sdvo_connector_funcs = {
|
||||
|
@ -1882,7 +1879,7 @@ static const struct drm_connector_funcs psb_intel_sdvo_connector_funcs = {
|
|||
static const struct drm_connector_helper_funcs psb_intel_sdvo_connector_helper_funcs = {
|
||||
.get_modes = psb_intel_sdvo_get_modes,
|
||||
.mode_valid = psb_intel_sdvo_mode_valid,
|
||||
.best_encoder = psb_intel_best_encoder,
|
||||
.best_encoder = gma_best_encoder,
|
||||
};
|
||||
|
||||
static void psb_intel_sdvo_enc_destroy(struct drm_encoder *encoder)
|
||||
|
@ -1894,7 +1891,7 @@ static void psb_intel_sdvo_enc_destroy(struct drm_encoder *encoder)
|
|||
psb_intel_sdvo->sdvo_lvds_fixed_mode);
|
||||
|
||||
i2c_del_adapter(&psb_intel_sdvo->ddc);
|
||||
psb_intel_encoder_destroy(encoder);
|
||||
gma_encoder_destroy(encoder);
|
||||
}
|
||||
|
||||
static const struct drm_encoder_funcs psb_intel_sdvo_enc_funcs = {
|
||||
|
@ -2055,7 +2052,7 @@ psb_intel_sdvo_connector_init(struct psb_intel_sdvo_connector *connector,
|
|||
connector->base.base.doublescan_allowed = 0;
|
||||
connector->base.base.display_info.subpixel_order = SubPixelHorizontalRGB;
|
||||
|
||||
psb_intel_connector_attach_encoder(&connector->base, &encoder->base);
|
||||
gma_connector_attach_encoder(&connector->base, &encoder->base);
|
||||
drm_sysfs_connector_add(&connector->base.base);
|
||||
}
|
||||
|
||||
|
@ -2075,7 +2072,7 @@ psb_intel_sdvo_dvi_init(struct psb_intel_sdvo *psb_intel_sdvo, int device)
|
|||
{
|
||||
struct drm_encoder *encoder = &psb_intel_sdvo->base.base;
|
||||
struct drm_connector *connector;
|
||||
struct psb_intel_connector *intel_connector;
|
||||
struct gma_connector *intel_connector;
|
||||
struct psb_intel_sdvo_connector *psb_intel_sdvo_connector;
|
||||
|
||||
psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL);
|
||||
|
@ -2115,7 +2112,7 @@ psb_intel_sdvo_tv_init(struct psb_intel_sdvo *psb_intel_sdvo, int type)
|
|||
{
|
||||
struct drm_encoder *encoder = &psb_intel_sdvo->base.base;
|
||||
struct drm_connector *connector;
|
||||
struct psb_intel_connector *intel_connector;
|
||||
struct gma_connector *intel_connector;
|
||||
struct psb_intel_sdvo_connector *psb_intel_sdvo_connector;
|
||||
|
||||
psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL);
|
||||
|
@ -2154,7 +2151,7 @@ psb_intel_sdvo_analog_init(struct psb_intel_sdvo *psb_intel_sdvo, int device)
|
|||
{
|
||||
struct drm_encoder *encoder = &psb_intel_sdvo->base.base;
|
||||
struct drm_connector *connector;
|
||||
struct psb_intel_connector *intel_connector;
|
||||
struct gma_connector *intel_connector;
|
||||
struct psb_intel_sdvo_connector *psb_intel_sdvo_connector;
|
||||
|
||||
psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL);
|
||||
|
@ -2188,7 +2185,7 @@ psb_intel_sdvo_lvds_init(struct psb_intel_sdvo *psb_intel_sdvo, int device)
|
|||
{
|
||||
struct drm_encoder *encoder = &psb_intel_sdvo->base.base;
|
||||
struct drm_connector *connector;
|
||||
struct psb_intel_connector *intel_connector;
|
||||
struct gma_connector *intel_connector;
|
||||
struct psb_intel_sdvo_connector *psb_intel_sdvo_connector;
|
||||
|
||||
psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL);
|
||||
|
@ -2540,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;
|
||||
|
||||
|
@ -2557,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++) {
|
||||
|
@ -2577,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))
|
||||
|
@ -2620,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