GMA500 updates
cover GMA500 updates
This set of patches tackles three basic things
- Add support for Moorestown (not yet usable as it needs a memory allocator)
- Completely remove all the ttm related glue from the driver
- Turn on SDVO support on Poulsbo - which should get the various non panel users working
Getting useful Moorestown support will need the power management tackling further, memory allocator and possibly MIPI panel support. For now the priority is Poulsbo.
---
Alan Cox (17):
gma500: turn on psb SDVO
gma500; kill off TTM
gma500: pull mrst firmware stuff into its own header
gma500: Clean up more unused structures and code
gma500: We don't support the CI either
gma500: delete the RAR handling
gma500: Add Moorestown identifiers
gma500: Moorestown does its setup differently
gma500: enable Moorestown CRTC handling
gma500: add framebuffer setup
gma500: Add Moorestown backlight support
gma500: Makefiles
gma500: Add moorestown specific data to the device structure
gma500: Add moorestown config structures
gma500: Make some of the lvds operations non-static
gma500: Add moorestown lvds driver code
gma500: begin adding Moorestown support
Justin P. Mattock (1):
drivers:staging:gma500 Remove extra semi-colon.
drivers/staging/gma500/Makefile | 11 drivers/staging/gma500/mrst.h | 217 ++++++++ drivers/staging/gma500/mrst_crtc.c | 623 +++++++++++++++++++++++ drivers/staging/gma500/mrst_lvds.c | 364 +++++++++++++ drivers/staging/gma500/psb_2d.c | 1 drivers/staging/gma500/psb_bl.c | 112 +++- drivers/staging/gma500/psb_buffer.c | 450 ---------------- drivers/staging/gma500/psb_drm.h | 111 ---- drivers/staging/gma500/psb_drv.c | 543 ++++++++------------ drivers/staging/gma500/psb_drv.h | 278 +--------- drivers/staging/gma500/psb_fb.c | 23 + drivers/staging/gma500/psb_fence.c | 122 ---- drivers/staging/gma500/psb_gtt.c | 51 -- drivers/staging/gma500/psb_gtt.h | 4 drivers/staging/gma500/psb_intel_display.c | 10 drivers/staging/gma500/psb_intel_lvds.c | 16 - drivers/staging/gma500/psb_sgx.c | 238 --------- drivers/staging/gma500/psb_sgx.h | 32 - drivers/staging/gma500/psb_ttm_fence.c | 605 ---------------------- drivers/staging/gma500/psb_ttm_fence_api.h | 272 ---------- drivers/staging/gma500/psb_ttm_fence_driver.h | 302 ----------- drivers/staging/gma500/psb_ttm_fence_user.c | 237 --------- drivers/staging/gma500/psb_ttm_fence_user.h | 140 ----- drivers/staging/gma500/psb_ttm_glue.c | 349 ------------- drivers/staging/gma500/psb_ttm_placement_user.c | 628 ----------------------- drivers/staging/gma500/psb_ttm_userobj_api.h | 85 --- 26 files changed, 1593 insertions(+), 4231 deletions(-) create mode 100644 drivers/staging/gma500/mrst.h create mode 100644 drivers/staging/gma500/mrst_crtc.c create mode 100644 drivers/staging/gma500/mrst_lvds.c delete mode 100644 drivers/staging/gma500/psb_buffer.c delete mode 100644 drivers/staging/gma500/psb_fence.c delete mode 100644 drivers/staging/gma500/psb_sgx.c delete mode 100644 drivers/staging/gma500/psb_sgx.h delete mode 100644 drivers/staging/gma500/psb_ttm_fence.c delete mode 100644 drivers/staging/gma500/psb_ttm_fence_api.h delete mode 100644 drivers/staging/gma500/psb_ttm_fence_driver.h delete mode 100644 drivers/staging/gma500/psb_ttm_fence_user.c delete mode 100644 drivers/staging/gma500/psb_ttm_fence_user.h delete mode 100644 drivers/staging/gma500/psb_ttm_glue.c delete mode 100644 drivers/staging/gma500/psb_ttm_placement_user.c delete mode 100644 drivers/staging/gma500/psb_ttm_userobj_api.h
Signature · 1 line
Alan
PATCH 1/18 gma500: begin adding Moorestown support
The Moorestown systems have some graphics differences we care about and some we don't need to.
To start with it has a single pipe and that pipe can be used for LVDS
---
drivers/staging/gma500/psb_drv.c | 6 ++++-- drivers/staging/gma500/psb_drv.h | 6 ++---- drivers/staging/gma500/psb_fb.c | 6 +++++- drivers/staging/gma500/psb_intel_display.c | 4 +++- drivers/staging/gma500/psb_intel_lvds.c | 8 ++++++-- 5 files changed, 20 insertions(+), 10 deletions(-)
drivers/staging/gma500/psb_drv.c +4 -2
@@ -586,8 +586,10 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)return -ENOMEM ;INIT_LIST_HEAD (&dev_priv->video_ctx); - dev_priv->num_pipe =2 ; - +if (IS_MRST (dev)) + dev_priv->num_pipe =1 ; +else + dev_priv->num_pipe =2 ; dev_priv->dev = dev; bdev = &dev_priv->bdev;
drivers/staging/gma500/psb_drv.h +2 -4
@@ -45,6 +45,8 @@ enum { CHIP_PSB_8109 = 1, }; +#define IS_MRST (dev) (((dev)->pci_device & 0xfffc) == 0x4100) +/* *Hardware bugfixes */
@@ -52,10 +54,6 @@ enum {#define DRIVER_NAME "pvrsrvkm"#define DRIVER_DESC "drm driver for the Intel GMA500"#define DRIVER_AUTHOR "Intel Corporation" -#define OSPM_PROC_ENTRY "ospm" -#define RTPM_PROC_ENTRY "rtpm" -#define BLC_PROC_ENTRY "mrst_blc" -#define DISPLAY_PROC_ENTRY "display_status"#define PSB_DRM_DRIVER_DATE "2009-03-10"#define PSB_DRM_DRIVER_MAJOR 8
drivers/staging/gma500/psb_fb.c +5 -1
@@ -716,7 +716,11 @@ static void psb_setup_outputs(struct drm_device *dev)break ;case INTEL_OUTPUT_LVDS :PSB_DEBUG_ENTRY ("LVDS.\n" ); - crtc_mask = (1 <<1 ); +if (IS_MRST (dev)) + crtc_mask = (1 <<0 ); +else + crtc_mask = (1 <<1 ); + clone_mask = (1 <<INTEL_OUTPUT_LVDS );break ;case INTEL_OUTPUT_MIPI :
drivers/staging/gma500/psb_intel_display.c +3 -1
@@ -569,7 +569,9 @@ static int psb_intel_panel_fitter_pipe(struct drm_device *dev)if ((pfit_control &PFIT_ENABLE ) ==0 )return -1 ;/* Must be on PIPE 1 for PSB */ -return 1 ; +if (!IS_MRST (dev)) +return 1 ; +return (pfit_control >>29 ) &3 ; } static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
drivers/staging/gma500/psb_intel_lvds.c +6 -2
@@ -400,11 +400,15 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,if (psb_intel_output->type ==INTEL_OUTPUT_MIPI2 ) panel_fixed_mode = mode_dev->panel_fixed_mode2; -/* PSB doesn't appear to be GEN4 */ -if (psb_intel_crtc->pipe ==0 ) { +/* PSB requires the LVDS is on pipe B, MRST has only one pipe anyway */ +if (!IS_MRST (dev) && psb_intel_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 ) { +printk (KERN_ERR "Must use PIPE A\n" ); +return false; + }/* Should never happen!! */ list_for_each_entry (tmp_encoder, &dev->mode_config.encoder_list, head) {
PATCH 2/18 gma500: Add moorestown lvds driver code
In reply to Alan CoxAdd the new files needed for the GMA500 driver to support Moorestown LVDS displays. Don't wire them in yet.
---
drivers/staging/gma500/mrst_crtc.c | 623 ++++++++++++++++++++++++++++++++++++ drivers/staging/gma500/mrst_lvds.c | 364 +++++++++++++++++++++ 2 files changed, 987 insertions(+), 0 deletions(-) create mode 100644 drivers/staging/gma500/mrst_crtc.c create mode 100644 drivers/staging/gma500/mrst_lvds.c
drivers/staging/gma500/mrst_crtc.c new file +623 -0
@@ -0,0 +1,623 @@ +/* +* Copyright © 2009 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. +*/ + +#include <linux/i2c.h> +#include <linux/pm_runtime.h> + +#include <drm/drmP.h> +#include "psb_fb.h" +#include "psb_drv.h" +#include "psb_intel_drv.h" +#include "psb_intel_reg.h" +#include "psb_intel_display.h" +#include "psb_powermgmt.h" + +struct psb_intel_range_t { +int min, max; +}; + +struct mrst_limit_t { +struct psb_intel_range_t dot, m, p1; +}; + +struct mrst_clock_t { +/* derived values */ +int dot; +int m; +int p1; +}; + +#define MRST_LIMIT_LVDS_100L 0 +#define MRST_LIMIT_LVDS_83 1 +#define MRST_LIMIT_LVDS_100 2 + +#define MRST_DOT_MIN 19750 +#define MRST_DOT_MAX 120000 +#define MRST_M_MIN_100L 20 +#define MRST_M_MIN_100 10 +#define MRST_M_MIN_83 12 +#define MRST_M_MAX_100L 34 +#define MRST_M_MAX_100 17 +#define MRST_M_MAX_83 20 +#define MRST_P1_MIN 2 +#define MRST_P1_MAX_0 7 +#define MRST_P1_MAX_1 8 + +static const struct mrst_limit_t mrst_limits[] = { + {/* MRST_LIMIT_LVDS_100L */ + .dot = {.min =MRST_DOT_MIN , .max =MRST_DOT_MAX }, + .m = {.min =MRST_M_MIN_100L , .max =MRST_M_MAX_100L }, + .p1 = {.min =MRST_P1_MIN , .max =MRST_P1_MAX_1 }, + }, + {/* MRST_LIMIT_LVDS_83L */ + .dot = {.min =MRST_DOT_MIN , .max =MRST_DOT_MAX }, + .m = {.min =MRST_M_MIN_83 , .max =MRST_M_MAX_83 }, + .p1 = {.min =MRST_P1_MIN , .max =MRST_P1_MAX_0 }, + }, + {/* MRST_LIMIT_LVDS_100 */ + .dot = {.min =MRST_DOT_MIN , .max =MRST_DOT_MAX }, + .m = {.min =MRST_M_MIN_100 , .max =MRST_M_MAX_100 }, + .p1 = {.min =MRST_P1_MIN , .max =MRST_P1_MAX_1 }, + }, +}; + +#define MRST_M_MIN 10 +static const u32 mrst_m_converts[] = { +0x2B ,0x15 ,0x2A ,0x35 ,0x1A ,0x0D ,0x26 ,0x33 ,0x19 ,0x2C , +0x36 ,0x3B ,0x1D ,0x2E ,0x37 ,0x1B ,0x2D ,0x16 ,0x0B ,0x25 , +0x12 ,0x09 ,0x24 ,0x32 ,0x39 ,0x1c , +}; + +static const struct mrst_limit_t *mrst_limit (struct drm_crtc *crtc) +{ +const struct mrst_limit_t *limit =NULL ; +struct drm_device *dev = crtc->dev; +DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private; + +if (psb_intel_pipe_has_type (crtc,INTEL_OUTPUT_LVDS ) + ||psb_intel_pipe_has_type (crtc,INTEL_OUTPUT_MIPI )) { +switch (dev_priv->core_freq) { +case 100 : + limit = &mrst_limits[MRST_LIMIT_LVDS_100L ]; +break ; +case 166 : + limit = &mrst_limits[MRST_LIMIT_LVDS_83 ]; +break ; +case 200 : + limit = &mrst_limits[MRST_LIMIT_LVDS_100 ]; +break ; + } + }else { + limit =NULL ; +PSB_DEBUG_ENTRY ("mrst_limit Wrong display type.\n" ); + } + +return limit; +} + +/** Derive the pixel clock for the given refclk and divisors for 8xx chips. */ +static void mrst_clock (int refclk,struct mrst_clock_t *clock) +{ + clock->dot = (refclk * clock->m) / (14 * clock->p1); +} + +void mrstPrintPll (char *prefix,struct mrst_clock_t *clock) +{ +PSB_DEBUG_ENTRY ("%s: dotclock = %d, m = %d, p1 = %d.\n" , + prefix, clock->dot, clock->m, clock->p1); +} + +/** +* Returns a set of divisors for the desired target clock with the given refclk, +* or FALSE. Divisor values are the actual divisors for +*/ +static bool +mrstFindBestPLL (struct drm_crtc *crtc,int target,int refclk, +struct mrst_clock_t *best_clock) +{ +struct mrst_clock_t clock; +const struct mrst_limit_t *limit =mrst_limit (crtc); +int err = target; + +memset (best_clock,0 ,sizeof (*best_clock)); + +for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { +for (clock.p1 = limit->p1.min; clock.p1 <= limit->p1.max; + clock.p1++) { +int this_err; + +mrst_clock (refclk, &clock); + + this_err =abs (clock.dot - target); +if (this_err < err) { + *best_clock = clock; + err = this_err; + } + } + } +DRM_DEBUG ("mrstFindBestPLL err = %d.\n" , err); + +return err != target; +} + +/** +* 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. +*/ +static void mrst_crtc_dpms (struct drm_crtc *crtc,int mode) +{ +struct drm_device *dev = crtc->dev; +struct psb_intel_crtc *psb_intel_crtc =to_psb_intel_crtc (crtc); +int pipe = psb_intel_crtc->pipe; +int dpll_reg = (pipe ==0 ) ?MRST_DPLL_A :DPLL_B ; +int dspcntr_reg = (pipe ==0 ) ?DSPACNTR :DSPBCNTR ; +int dspbase_reg = (pipe ==0 ) ?MRST_DSPABASE :DSPBBASE ; +int pipeconf_reg = (pipe ==0 ) ?PIPEACONF :PIPEBCONF ; +u32 temp; +bool enabled; + +PSB_DEBUG_ENTRY ("mode = %d, pipe = %d\n" , mode, pipe); + +if (!ospm_power_using_hw_begin (OSPM_DISPLAY_ISLAND , +OSPM_UHB_FORCE_POWER_ON )) +return ; + +/* 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. +*/ +switch (mode) { +case DRM_MODE_DPMS_ON : +case DRM_MODE_DPMS_STANDBY : +case DRM_MODE_DPMS_SUSPEND : +/* Enable the DPLL */ + temp =REG_READ (dpll_reg); +if ((temp &DPLL_VCO_ENABLE ) ==0 ) { +REG_WRITE (dpll_reg, temp); +REG_READ (dpll_reg); +/* Wait for the clocks to stabilize. */ +udelay (150 ); +REG_WRITE (dpll_reg, temp |DPLL_VCO_ENABLE ); +REG_READ (dpll_reg); +/* Wait for the clocks to stabilize. */ +udelay (150 ); +REG_WRITE (dpll_reg, temp |DPLL_VCO_ENABLE ); +REG_READ (dpll_reg); +/* Wait for the clocks to stabilize. */ +udelay (150 ); + } +/* Enable the pipe */ + temp =REG_READ (pipeconf_reg); +if ((temp &PIPEACONF_ENABLE ) ==0 ) +REG_WRITE (pipeconf_reg, temp |PIPEACONF_ENABLE ); +/* Enable the plane */ + temp =REG_READ (dspcntr_reg); +if ((temp &DISPLAY_PLANE_ENABLE ) ==0 ) { +REG_WRITE (dspcntr_reg, + temp |DISPLAY_PLANE_ENABLE ); +/* Flush the plane changes */ +REG_WRITE (dspbase_reg,REG_READ (dspbase_reg)); + } + +psb_intel_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 : +/* 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 ); +/* Disable display plane */ + temp =REG_READ (dspcntr_reg); +if ((temp &DISPLAY_PLANE_ENABLE ) !=0 ) { +REG_WRITE (dspcntr_reg, + temp & ~DISPLAY_PLANE_ENABLE ); +/* Flush the plane changes */ +REG_WRITE (dspbase_reg,REG_READ (dspbase_reg)); +REG_READ (dspbase_reg); + } + +/* Next, disable display pipes */ + temp =REG_READ (pipeconf_reg); +if ((temp &PIPEACONF_ENABLE ) !=0 ) { +REG_WRITE (pipeconf_reg, temp & ~PIPEACONF_ENABLE ); +REG_READ (pipeconf_reg); + } +/* Wait for for the pipe disable to take effect. */ +psb_intel_wait_for_vblank (dev); + + temp =REG_READ (dpll_reg); +if ((temp &DPLL_VCO_ENABLE ) !=0 ) { +REG_WRITE (dpll_reg, temp & ~DPLL_VCO_ENABLE ); +REG_READ (dpll_reg); + } + +/* Wait for the clocks to turn off. */ +udelay (150 ); +break ; + } + + enabled = crtc->enabled && mode !=DRM_MODE_DPMS_OFF ; + +/*Set FIFO Watermarks*/ +REG_WRITE (DSPARB ,0x3FFF ); +REG_WRITE (DSPFW1 ,0x3F88080A ); +REG_WRITE (DSPFW2 ,0x0b060808 ); +REG_WRITE (DSPFW3 ,0x0 ); +REG_WRITE (DSPFW4 ,0x08030404 ); +REG_WRITE (DSPFW5 ,0x04040404 ); +REG_WRITE (DSPFW6 ,0x78 ); +REG_WRITE (0x70400 ,REG_READ (0x70400 ) |0x4000 ); +/* Must write Bit 14 of the Chicken Bit Register */ + +ospm_power_using_hw_end (OSPM_DISPLAY_ISLAND ); +} + +/** +* Return the pipe currently connected to the panel fitter, +* or -1 if the panel fitter is not present or not in use +*/ +static int mrst_panel_fitter_pipe (struct drm_device *dev) +{ +u32 pfit_control; + + pfit_control =REG_READ (PFIT_CONTROL ); + +/* See if the panel fitter is in use */ +if ((pfit_control &PFIT_ENABLE ) ==0 ) +return -1 ; +return (pfit_control >>29 ) &3 ; +} + +static int mrst_crtc_mode_set (struct drm_crtc *crtc, +struct drm_display_mode *mode, +struct drm_display_mode *adjusted_mode, +int x,int y, +struct drm_framebuffer *old_fb) +{ +struct drm_device *dev = crtc->dev; +struct psb_intel_crtc *psb_intel_crtc =to_psb_intel_crtc (crtc); +DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private; +int pipe = psb_intel_crtc->pipe; +int fp_reg = (pipe ==0 ) ?MRST_FPA0 :FPB0 ; +int dpll_reg = (pipe ==0 ) ?MRST_DPLL_A :DPLL_B ; +int dspcntr_reg = (pipe ==0 ) ?DSPACNTR :DSPBCNTR ; +int pipeconf_reg = (pipe ==0 ) ?PIPEACONF :PIPEBCONF ; +int htot_reg = (pipe ==0 ) ?HTOTAL_A :HTOTAL_B ; +int hblank_reg = (pipe ==0 ) ?HBLANK_A :HBLANK_B ; +int hsync_reg = (pipe ==0 ) ?HSYNC_A :HSYNC_B ; +int vtot_reg = (pipe ==0 ) ?VTOTAL_A :VTOTAL_B ; +int vblank_reg = (pipe ==0 ) ?VBLANK_A :VBLANK_B ; +int vsync_reg = (pipe ==0 ) ?VSYNC_A :VSYNC_B ; +int pipesrc_reg = (pipe ==0 ) ?PIPEASRC :PIPEBSRC ; +int refclk =0 ; +struct mrst_clock_t clock; +u32 dpll =0 , fp =0 , dspcntr, pipeconf; +bool ok, is_sdvo = false; +bool is_crt = false, is_lvds = false, is_tv = false; +bool is_mipi = false; +struct drm_mode_config *mode_config = &dev->mode_config; +struct psb_intel_output *psb_intel_output =NULL ; +uint64_t scalingType =DRM_MODE_SCALE_FULLSCREEN ; +struct drm_encoder *encoder; + +PSB_DEBUG_ENTRY ("pipe = 0x%x\n" , pipe); + +if (!ospm_power_using_hw_begin (OSPM_DISPLAY_ISLAND , +OSPM_UHB_FORCE_POWER_ON )) +return 0 ; + +memcpy (&psb_intel_crtc->saved_mode, + mode, +sizeof (struct drm_display_mode )); +memcpy (&psb_intel_crtc->saved_adjusted_mode, + adjusted_mode, +sizeof (struct drm_display_mode )); + +list_for_each_entry (encoder, &mode_config->encoder_list, head) { + +if (encoder->crtc != crtc) +continue ; + + psb_intel_output =enc_to_psb_intel_output (encoder); +switch (psb_intel_output->type) { +case INTEL_OUTPUT_LVDS : + is_lvds = true; +break ; +case INTEL_OUTPUT_SDVO : + is_sdvo = true; +break ; +case INTEL_OUTPUT_TVOUT : + is_tv = true; +break ; +case INTEL_OUTPUT_ANALOG : + is_crt = true; +break ; +case INTEL_OUTPUT_MIPI : + is_mipi = true; +break ; + } + } + +/* Disable the VGA plane that we never use */ +REG_WRITE (VGACNTRL ,VGA_DISP_DISABLE ); + +/* Disable the panel fitter if it was on our pipe */ +if (mrst_panel_fitter_pipe (dev) == pipe) +REG_WRITE (PFIT_CONTROL ,0 ); + +REG_WRITE (pipesrc_reg, + ((mode->crtc_hdisplay -1 ) <<16 ) | + (mode->crtc_vdisplay -1 )); + +if (psb_intel_output) +drm_connector_property_get_value (&psb_intel_output->base, + dev->mode_config.scaling_mode_property, &scalingType); + +if (scalingType ==DRM_MODE_SCALE_NO_SCALE ) { +/* Moorestown doesn't have register support for centering so +* we need to mess with the h/vblank and h/vsync start and +* ends to get centering */ +int offsetX =0 , offsetY =0 ; + + offsetX = (adjusted_mode->crtc_hdisplay - + mode->crtc_hdisplay) /2 ; + offsetY = (adjusted_mode->crtc_vdisplay - + mode->crtc_vdisplay) /2 ; + +REG_WRITE (htot_reg, (mode->crtc_hdisplay -1 ) | + ((adjusted_mode->crtc_htotal -1 ) <<16 )); +REG_WRITE (vtot_reg, (mode->crtc_vdisplay -1 ) | + ((adjusted_mode->crtc_vtotal -1 ) <<16 )); +REG_WRITE (hblank_reg, + (adjusted_mode->crtc_hblank_start - offsetX -1 ) | + ((adjusted_mode->crtc_hblank_end - offsetX -1 ) <<16 )); +REG_WRITE (hsync_reg, + (adjusted_mode->crtc_hsync_start - offsetX -1 ) | + ((adjusted_mode->crtc_hsync_end - offsetX -1 ) <<16 )); +REG_WRITE (vblank_reg, + (adjusted_mode->crtc_vblank_start - offsetY -1 ) | + ((adjusted_mode->crtc_vblank_end - offsetY -1 ) <<16 )); +REG_WRITE (vsync_reg, + (adjusted_mode->crtc_vsync_start - offsetY -1 ) | + ((adjusted_mode->crtc_vsync_end - offsetY -1 ) <<16 )); + }else { +REG_WRITE (htot_reg, (adjusted_mode->crtc_hdisplay -1 ) | + ((adjusted_mode->crtc_htotal -1 ) <<16 )); +REG_WRITE (vtot_reg, (adjusted_mode->crtc_vdisplay -1 ) | + ((adjusted_mode->crtc_vtotal -1 ) <<16 )); +REG_WRITE (hblank_reg, (adjusted_mode->crtc_hblank_start -1 ) | + ((adjusted_mode->crtc_hblank_end -1 ) <<16 )); +REG_WRITE (hsync_reg, (adjusted_mode->crtc_hsync_start -1 ) | + ((adjusted_mode->crtc_hsync_end -1 ) <<16 )); +REG_WRITE (vblank_reg, (adjusted_mode->crtc_vblank_start -1 ) | + ((adjusted_mode->crtc_vblank_end -1 ) <<16 )); +REG_WRITE (vsync_reg, (adjusted_mode->crtc_vsync_start -1 ) | + ((adjusted_mode->crtc_vsync_end -1 ) <<16 )); + } + +/* Flush the plane changes */ + { +struct drm_crtc_helper_funcs *crtc_funcs = + crtc->helper_private; + crtc_funcs->mode_set_base (crtc, x, y, old_fb); + } + +/* setup pipeconf */ + pipeconf =REG_READ (pipeconf_reg); + +/* Set up the display plane register */ + dspcntr =REG_READ (dspcntr_reg); + dspcntr |=DISPPLANE_GAMMA_ENABLE ; + +if (pipe ==0 ) + dspcntr |=DISPPLANE_SEL_PIPE_A ; +else + dspcntr |=DISPPLANE_SEL_PIPE_B ; + + dev_priv->dspcntr = dspcntr |=DISPLAY_PLANE_ENABLE ; + dev_priv->pipeconf = pipeconf |=PIPEACONF_ENABLE ; + +if (is_mipi) + goto mrst_crtc_mode_set_exit; + + refclk = dev_priv->core_freq *1000 ; + + dpll =0 ;/*BIT16 = 0 for 100MHz reference */ + + ok =mrstFindBestPLL (crtc, adjusted_mode->clock, refclk, &clock); + +if (!ok) { +PSB_DEBUG_ENTRY ( +"mrstFindBestPLL fail in mrst_crtc_mode_set.\n" ); + }else { +PSB_DEBUG_ENTRY ("mrst_crtc_mode_set pixel clock = %d," +"m = %x, p1 = %x.\n" , clock.dot, clock.m, + clock.p1); + } + + fp = mrst_m_converts[(clock.m -MRST_M_MIN )] <<8 ; + + dpll |=DPLL_VGA_MODE_DIS ; + + + dpll |=DPLL_VCO_ENABLE ; + +if (is_lvds) + dpll |=DPLLA_MODE_LVDS ; +else + dpll |=DPLLB_MODE_DAC_SERIAL ; + +if (is_sdvo) { +int sdvo_pixel_multiply = + adjusted_mode->clock / mode->clock; + + dpll |=DPLL_DVO_HIGH_SPEED ; + dpll |= + (sdvo_pixel_multiply - +1 ) <<SDVO_MULTIPLIER_SHIFT_HIRES ; + } + + +/* compute bitmask from p1 value */ + dpll |= (1 << (clock.p1 -2 )) <<17 ; + + dpll |=DPLL_VCO_ENABLE ; + +mrstPrintPll ("chosen" , &clock); + +if (dpll &DPLL_VCO_ENABLE ) { +REG_WRITE (fp_reg, fp); +REG_WRITE (dpll_reg, dpll & ~DPLL_VCO_ENABLE ); +REG_READ (dpll_reg); +/* Check the DPLLA lock bit PIPEACONF[29] */ +udelay (150 ); + } + +REG_WRITE (fp_reg, fp); +REG_WRITE (dpll_reg, dpll); +REG_READ (dpll_reg); +/* Wait for the clocks to stabilize. */ +udelay (150 ); + +/* write it again -- the BIOS does, after all */ +REG_WRITE (dpll_reg, dpll); +REG_READ (dpll_reg); +/* Wait for the clocks to stabilize. */ +udelay (150 ); + +REG_WRITE (pipeconf_reg, pipeconf); +REG_READ (pipeconf_reg); +psb_intel_wait_for_vblank (dev); + +REG_WRITE (dspcntr_reg, dspcntr); +psb_intel_wait_for_vblank (dev); + +mrst_crtc_mode_set_exit: +ospm_power_using_hw_end (OSPM_DISPLAY_ISLAND ); +return 0 ; +} + +static bool mrst_crtc_mode_fixup (struct drm_crtc *crtc, +struct drm_display_mode *mode, +struct drm_display_mode *adjusted_mode) +{ +return true; +} + +int mrst_pipe_set_base (struct drm_crtc *crtc, +int x,int y,struct drm_framebuffer *old_fb) +{ +struct drm_device *dev = crtc->dev; +/* struct drm_i915_master_private *master_priv; */ +struct psb_intel_crtc *psb_intel_crtc =to_psb_intel_crtc (crtc); +struct psb_framebuffer *psbfb =to_psb_fb (crtc->fb); +struct psb_intel_mode_device *mode_dev = psb_intel_crtc->mode_dev; +int pipe = psb_intel_crtc->pipe; +unsigned long Start, Offset; +/* FIXME: check if we need this surely MRST is pipe 0 only */ +int dspbase = (pipe ==0 ?DSPALINOFF :DSPBBASE ); +int dspsurf = (pipe ==0 ?DSPASURF :DSPBSURF ); +int dspstride = (pipe ==0 ) ?DSPASTRIDE :DSPBSTRIDE ; +int dspcntr_reg = (pipe ==0 ) ?DSPACNTR :DSPBCNTR ; +u32 dspcntr; +int ret =0 ; + +PSB_DEBUG_ENTRY ("\n" ); + +/* no fb bound */ +if (!crtc->fb) { +DRM_DEBUG ("No FB bound\n" ); +return 0 ; + } + +if (!ospm_power_using_hw_begin (OSPM_DISPLAY_ISLAND , +OSPM_UHB_FORCE_POWER_ON )) +return 0 ; + + Start = mode_dev->bo_offset (dev, psbfb); + Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel /8 ); + +REG_WRITE (dspstride, crtc->fb->pitch); + + dspcntr =REG_READ (dspcntr_reg); + 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 : +DRM_ERROR ("Unknown color depth\n" ); + ret = -EINVAL ; + goto pipe_set_base_exit; + } +REG_WRITE (dspcntr_reg, dspcntr); + +DRM_DEBUG ("Writing base %08lX %08lX %d %d\n" , Start, Offset, x, y); +if (0 /* FIXMEAC - check what PSB needs */ ) { +REG_WRITE (dspbase, Offset); +REG_READ (dspbase); +REG_WRITE (dspsurf, Start); +REG_READ (dspsurf); + }else { +REG_WRITE (dspbase, Start + Offset); +REG_READ (dspbase); + } + +pipe_set_base_exit: +ospm_power_using_hw_end (OSPM_DISPLAY_ISLAND ); +return ret; +} + +static void mrst_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 mrst_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 mrst_helper_funcs = { + .dpms = mrst_crtc_dpms, + .mode_fixup = mrst_crtc_mode_fixup, + .mode_set = mrst_crtc_mode_set, + .mode_set_base = mrst_pipe_set_base, + .prepare = mrst_crtc_prepare, + .commit = mrst_crtc_commit, +}; +
drivers/staging/gma500/mrst_lvds.c new file +364 -0
364 lines not on this page · raw message
PATCH 3/18 gma500: Make some of the lvds operations non-static
In reply to Alan CoxWe need these as they are also used by the Moorestown LVDS display support. Make the various needed symbols visible in the headers
---
drivers/staging/gma500/psb_drv.h | 15 +++++++++++++++ drivers/staging/gma500/psb_intel_display.c | 4 ---- drivers/staging/gma500/psb_intel_lvds.c | 8 ++++---- 3 files changed, 19 insertions(+), 8 deletions(-)
drivers/staging/gma500/psb_drv.h +15 -0
@@ -948,6 +948,21 @@ int psb_set_brightness(struct backlight_device *bd);int psb_get_brightness (struct backlight_device *bd);struct backlight_device *psb_get_backlight_device (void ); +/* mrst_crtc.c */ +extern const struct drm_crtc_helper_funcs mrst_helper_funcs; + +/* mrst_lvds.c */ +extern void mrst_lvds_init (struct drm_device *dev, +struct psb_intel_mode_device *mode_dev); + +/* psb_intel_lvds.c */ +extern void psb_intel_lvds_prepare (struct drm_encoder *encoder); +extern void psb_intel_lvds_commit (struct drm_encoder *encoder); +extern const struct drm_connector_helper_funcs + psb_intel_lvds_connector_helper_funcs; +extern const struct drm_connector_funcs psb_intel_lvds_connector_funcs; + +/* *Debug print bits setting */
drivers/staging/gma500/psb_intel_display.c +0 -4
@@ -1335,10 +1335,6 @@ static const struct drm_crtc_helper_funcs psb_intel_helper_funcs = { .commit = psb_intel_crtc_commit, }; -static const struct drm_crtc_helper_funcs mrst_helper_funcs; -static const struct drm_crtc_helper_funcs mdfld_helper_funcs; -const struct drm_crtc_funcs mdfld_intel_crtc_funcs; -const struct drm_crtc_funcs psb_intel_crtc_funcs = { .save = psb_intel_crtc_save, .restore = psb_intel_crtc_restore,
drivers/staging/gma500/psb_intel_lvds.c +4 -4
@@ -449,7 +449,7 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,return true; } -static void psb_intel_lvds_prepare (struct drm_encoder *encoder) +void psb_intel_lvds_prepare (struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev;struct psb_intel_output *output =enc_to_psb_intel_output (encoder);
@@ -470,7 +470,7 @@ static void psb_intel_lvds_prepare(struct drm_encoder *encoder)ospm_power_using_hw_end (OSPM_DISPLAY_ISLAND ); } -static void psb_intel_lvds_commit (struct drm_encoder *encoder) +void psb_intel_lvds_commit (struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev;struct psb_intel_output *output =enc_to_psb_intel_output (encoder);
@@ -673,14 +673,14 @@ static const struct drm_encoder_helper_funcs psb_intel_lvds_helper_funcs = { .commit = psb_intel_lvds_commit, }; -static const struct drm_connector_helper_funcs +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, }; -static const struct drm_connector_funcs psb_intel_lvds_connector_funcs = { +const struct drm_connector_funcs psb_intel_lvds_connector_funcs = { .dpms = drm_helper_connector_dpms, .save = psb_intel_lvds_save, .restore = psb_intel_lvds_restore,
PATCH 4/18 gma500: Add moorestown config structures
In reply to Alan CoxWe have a set of firmware passed descriptors and things we need to grovel through for video configuration. This differs from the setup for the PC style Poulsbo hardware.
---
drivers/staging/gma500/psb_drv.h | 188 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 188 insertions(+), 0 deletions(-)
drivers/staging/gma500/psb_drv.h +188 -0
@@ -332,6 +332,194 @@ struct psb_video_ctx {/* todo: more context specific data for multi-context support */ }; +struct mrst_vbt { +s8 signature[4 ];/*4 bytes,"$GCT" */ +u8 revision; +u8 size; +u8 checksum; +void *mrst_gct; +} __attribute__ ((packed)); + +struct mrst_timing_info { +u16 pixel_clock; +u8 hactive_lo; +u8 hblank_lo; +u8 hblank_hi:4 ; +u8 hactive_hi:4 ; +u8 vactive_lo; +u8 vblank_lo; +u8 vblank_hi:4 ; +u8 vactive_hi:4 ; +u8 hsync_offset_lo; +u8 hsync_pulse_width_lo; +u8 vsync_pulse_width_lo:4 ; +u8 vsync_offset_lo:4 ; +u8 vsync_pulse_width_hi:2 ; +u8 vsync_offset_hi:2 ; +u8 hsync_pulse_width_hi:2 ; +u8 hsync_offset_hi:2 ; +u8 width_mm_lo; +u8 height_mm_lo; +u8 height_mm_hi:4 ; +u8 width_mm_hi:4 ; +u8 hborder; +u8 vborder; +u8 unknown0:1 ; +u8 hsync_positive:1 ; +u8 vsync_positive:1 ; +u8 separate_sync:2 ; +u8 stereo:1 ; +u8 unknown6:1 ; +u8 interlaced:1 ; +} __attribute__((packed)); + +struct gct_r10_timing_info { +u16 pixel_clock; +u32 hactive_lo:8 ; +u32 hactive_hi:4 ; +u32 hblank_lo:8 ; +u32 hblank_hi:4 ; +u32 hsync_offset_lo:8 ; +u16 hsync_offset_hi:2 ; +u16 hsync_pulse_width_lo:8 ; +u16 hsync_pulse_width_hi:2 ; +u16 hsync_positive:1 ; +u16 rsvd_1:3 ; +u8 vactive_lo:8 ; +u16 vactive_hi:4 ; +u16 vblank_lo:8 ; +u16 vblank_hi:4 ; +u16 vsync_offset_lo:4 ; +u16 vsync_offset_hi:2 ; +u16 vsync_pulse_width_lo:4 ; +u16 vsync_pulse_width_hi:2 ; +u16 vsync_positive:1 ; +u16 rsvd_2:3 ; +} __attribute__((packed)); + +struct mrst_panel_descriptor_v1 { +u32 Panel_Port_Control;/* 1 dword, Register 0x61180 if LVDS */ +/* 0x61190 if MIPI */ +u32 Panel_Power_On_Sequencing;/*1 dword,Register 0x61208,*/ +u32 Panel_Power_Off_Sequencing;/*1 dword,Register 0x6120C,*/ +u32 Panel_Power_Cycle_Delay_and_Reference_Divisor;/* 1 dword */ +/* Register 0x61210 */ +struct mrst_timing_info DTD;/*18 bytes, Standard definition */ +u16 Panel_Backlight_Inverter_Descriptor;/* 16 bits, as follows */ +/* Bit 0, Frequency, 15 bits,0 - 32767Hz */ +/* Bit 15, Polarity, 1 bit, 0: Normal, 1: Inverted */ +u16 Panel_MIPI_Display_Descriptor; +/*16 bits, Defined as follows: */ +/* if MIPI, 0x0000 if LVDS */ +/* Bit 0, Type, 2 bits, */ +/* 0: Type-1, */ +/* 1: Type-2, */ +/* 2: Type-3, */ +/* 3: Type-4 */ +/* Bit 2, Pixel Format, 4 bits */ +/* Bit0: 16bpp (not supported in LNC), */ +/* Bit1: 18bpp loosely packed, */ +/* Bit2: 18bpp packed, */ +/* Bit3: 24bpp */ +/* Bit 6, Reserved, 2 bits, 00b */ +/* Bit 8, Minimum Supported Frame Rate, 6 bits, 0 - 63Hz */ +/* Bit 14, Reserved, 2 bits, 00b */ +} __attribute__ ((packed)); + +struct mrst_panel_descriptor_v2 { +u32 Panel_Port_Control;/* 1 dword, Register 0x61180 if LVDS */ +/* 0x61190 if MIPI */ +u32 Panel_Power_On_Sequencing;/*1 dword,Register 0x61208,*/ +u32 Panel_Power_Off_Sequencing;/*1 dword,Register 0x6120C,*/ +u8 Panel_Power_Cycle_Delay_and_Reference_Divisor;/* 1 byte */ +/* Register 0x61210 */ +struct mrst_timing_info DTD;/*18 bytes, Standard definition */ +u16 Panel_Backlight_Inverter_Descriptor;/*16 bits, as follows*/ +/*Bit 0, Frequency, 16 bits, 0 - 32767Hz*/ +u8 Panel_Initial_Brightness;/* [7:0] 0 - 100% */ +/*Bit 7, Polarity, 1 bit,0: Normal, 1: Inverted*/ +u16 Panel_MIPI_Display_Descriptor; +/*16 bits, Defined as follows: */ +/* if MIPI, 0x0000 if LVDS */ +/* Bit 0, Type, 2 bits, */ +/* 0: Type-1, */ +/* 1: Type-2, */ +/* 2: Type-3, */ +/* 3: Type-4 */ +/* Bit 2, Pixel Format, 4 bits */ +/* Bit0: 16bpp (not supported in LNC), */ +/* Bit1: 18bpp loosely packed, */ +/* Bit2: 18bpp packed, */ +/* Bit3: 24bpp */ +/* Bit 6, Reserved, 2 bits, 00b */ +/* Bit 8, Minimum Supported Frame Rate, 6 bits, 0 - 63Hz */ +/* Bit 14, Reserved, 2 bits, 00b */ +} __attribute__ ((packed)); + +union mrst_panel_rx { +struct { +u16 NumberOfLanes:2 ;/*Num of Lanes, 2 bits,0 = 1 lane,*/ +/* 1 = 2 lanes, 2 = 3 lanes, 3 = 4 lanes. */ +u16 MaxLaneFreq:3 ;/* 0: 100MHz, 1: 200MHz, 2: 300MHz, */ +/*3: 400MHz, 4: 500MHz, 5: 600MHz, 6: 700MHz, 7: 800MHz.*/ +u16 SupportedVideoTransferMode:2 ;/*0: Non-burst only */ +/* 1: Burst and non-burst */ +/* 2/3: Reserved */ +u16 HSClkBehavior:1 ;/*0: Continuous, 1: Non-continuous*/ +u16 DuoDisplaySupport:1 ;/*1 bit,0: No, 1: Yes*/ +u16 ECC_ChecksumCapabilities:1 ;/*1 bit,0: No, 1: Yes*/ +u16 BidirectionalCommunication:1 ;/*1 bit,0: No, 1: Yes */ +u16 Rsvd:5 ;/*5 bits,00000b */ + } panelrx; +u16 panel_receiver; +} __attribute__ ((packed)); + +struct mrst_gct_v1 { +union {/*8 bits,Defined as follows: */ +struct { +u8 PanelType:4 ;/*4 bits, Bit field for panels*/ +/* 0 - 3: 0 = LVDS, 1 = MIPI*/ +/*2 bits,Specifies which of the*/ +u8 BootPanelIndex:2 ; +/* 4 panels to use by default*/ +u8 BootMIPI_DSI_RxIndex:2 ;/*Specifies which of*/ +/* the 4 MIPI DSI receivers to use*/ + } PD; +u8 PanelDescriptor; + }; +struct mrst_panel_descriptor_v1 panel[4 ];/*panel descrs,38 bytes each*/ +union mrst_panel_rx panelrx[4 ];/* panel receivers*/ +} __attribute__ ((packed)); + +struct mrst_gct_v2 { +union {/*8 bits,Defined as follows: */ +struct { +u8 PanelType:4 ;/*4 bits, Bit field for panels*/ +/* 0 - 3: 0 = LVDS, 1 = MIPI*/ +/*2 bits,Specifies which of the*/ +u8 BootPanelIndex:2 ; +/* 4 panels to use by default*/ +u8 BootMIPI_DSI_RxIndex:2 ;/*Specifies which of*/ +/* the 4 MIPI DSI receivers to use*/ + } PD; +u8 PanelDescriptor; + }; +struct mrst_panel_descriptor_v2 panel[4 ];/*panel descrs,38 bytes each*/ +union mrst_panel_rx panelrx[4 ];/* panel receivers*/ +} __attribute__ ((packed)); + +struct mrst_gct_data { +u8 bpi;/* boot panel index, number of panel used during boot */ +u8 pt;/* panel type, 4 bit field, 0=lvds, 1=mipi */ +struct mrst_timing_info DTD;/* timing info for the selected panel */ +u32 Panel_Port_Control; +u32 PP_On_Sequencing;/*1 dword,Register 0x61208,*/ +u32 PP_Off_Sequencing;/*1 dword,Register 0x6120C,*/ +u32 PP_Cycle_Delay; +u16 Panel_Backlight_Inverter_Descriptor; +u16 Panel_MIPI_Display_Descriptor; +} __attribute__ ((packed)); +#define MODE_SETTING_IN_CRTC 0x1#define MODE_SETTING_IN_ENCODER 0x2#define MODE_SETTING_ON_GOING 0x3
PATCH 5/18 gma500: Add moorestown specific data to the device structure
In reply to Alan CoxMoorestown needs somewhere to stash various pipe config registers and the firmware and fuse configurations
---
drivers/staging/gma500/psb_drv.h | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-)
drivers/staging/gma500/psb_drv.h +17 -1
@@ -644,7 +644,8 @@ struct drm_psb_private {struct drm_psb_sizes_arg sizes; -uint32_t fuse_reg_value; +u32 fuse_reg_value; +u32 video_device_fuse;/* pci revision id for B0:D2:F0 */ uint8_t platform_rev_id;
@@ -669,6 +670,7 @@ struct drm_psb_private { unsigned int lvds_use_ssc:1;int lvds_ssc_freq;bool is_lvds_on; +bool is_mipi_on;unsigned int core_freq;uint32_t iLVDS_enable;
@@ -676,6 +678,20 @@ struct drm_psb_private {/*runtime PM state*/ int rpm_enabled; +/* Moorestown specific */ +struct mrst_vbt vbt_data; +struct mrst_gct_data gct_data; + +/* Moorestown pipe config register value cache */ +uint32_t pipeconf; +uint32_t pipeconf1; +uint32_t pipeconf2; + +/* Moorestown plane control register value cache */ +uint32_t dspcntr; +uint32_t dspcntr1; +uint32_t dspcntr2; +/* *Register state */
PATCH 6/18 gma500: Makefiles
In reply to Alan CoxBuild the new files now all the changes they need are present. They won't yet be used but the plumbing is next step.
---
drivers/staging/gma500/Makefile | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/staging/gma500/Makefile +3 -1
@@ -26,6 +26,8 @@ psb_gfx-y += psb_bl.o \ psb_ttm_fence_user.o \ psb_ttm_placement_user.o \ psb_powermgmt.o \ - psb_irq.o + psb_irq.o \ + mrst_crtc.o \ + mrst_lvds.o obj-$(CONFIG_DRM_PSB) += psb_gfx.o
PATCH 7/18 gma500: Add Moorestown backlight support
In reply to Alan CoxWhich is of course different to Poulsbo.
---
drivers/staging/gma500/psb_bl.c | 112 ++++++++++++++++++++++++++++++--------- 1 files changed, 85 insertions(+), 27 deletions(-)
drivers/staging/gma500/psb_bl.c +85 -27
@@ -33,7 +33,6 @@#define BLC_PWM_FREQ_CALC_CONSTANT 32#define MHz 1000000#define BRIGHTNESS_MIN_LEVEL 1 -#define BRIGHTNESS_MAX_LEVEL 100#define BRIGHTNESS_MASK 0xFF#define BLC_POLARITY_NORMAL 0#define BLC_POLARITY_INVERSE 1
@@ -59,15 +58,57 @@ int psb_set_brightness(struct backlight_device *bd)DRM_DEBUG_DRIVER ("backlight level set to %d\n" , level); -/* Perform value bounds checking */ -if (level <BRIGHTNESS_MIN_LEVEL ) - level =BRIGHTNESS_MIN_LEVEL ; +/* Percentage 1-100% being valid */ +if (level <1 ) + level =1 ;psb_intel_lvds_set_brightness (dev, level); psb_brightness = level;return 0 ; } +int mrst_set_brightness (struct backlight_device *bd) +{ +struct drm_device *dev =bl_get_data (psb_backlight_device); +struct drm_psb_private *dev_priv = dev->dev_private; +int level = bd->props.brightness; +u32 blc_pwm_ctl; +u32 max_pwm_blc; + +DRM_DEBUG_DRIVER ("backlight level set to %d\n" , level); + +/* Percentage 1-100% being valid */ +if (level <1 ) + level =1 ; + +if (ospm_power_using_hw_begin (OSPM_DISPLAY_ISLAND ,OSPM_UHB_ONLY_IF_ON )) { +/* Calculate and set the brightness value */ + max_pwm_blc =REG_READ (BLC_PWM_CTL ) >>16 ; + blc_pwm_ctl = level * max_pwm_blc /100 ; + +/* Adjust the backlight level with the percent in +* dev_priv->blc_adj1; +*/ + blc_pwm_ctl = blc_pwm_ctl * dev_priv->blc_adj1; + blc_pwm_ctl = blc_pwm_ctl /100 ; + +/* Adjust the backlight level with the percent in +* dev_priv->blc_adj2; +*/ + blc_pwm_ctl = blc_pwm_ctl * dev_priv->blc_adj2; + blc_pwm_ctl = blc_pwm_ctl /100 ; + +if (blc_pol ==BLC_POLARITY_INVERSE ) + blc_pwm_ctl = max_pwm_blc - blc_pwm_ctl; +/* force PWM bit on */ +REG_WRITE (BLC_PWM_CTL2 , (0x80000000 |REG_READ (BLC_PWM_CTL2 ))); +REG_WRITE (BLC_PWM_CTL , (max_pwm_blc <<16 ) | blc_pwm_ctl); +ospm_power_using_hw_end (OSPM_DISPLAY_ISLAND ); + } + psb_brightness = level; +return 0 ; +} +int psb_get_brightness (struct backlight_device *bd) {DRM_DEBUG_DRIVER ("brightness = 0x%x\n" , psb_brightness);
@@ -85,24 +126,33 @@ static const struct backlight_ops psb_ops = {static int device_backlight_init (struct drm_device *dev) { +struct drm_psb_private *dev_priv = dev->dev_private;unsigned long core_clock;/* u32 bl_max_freq; */ /* unsigned long value; */ u16 bl_max_freq;uint32_t value;uint32_t blc_pwm_precision_factor; -struct drm_psb_private *dev_priv = dev->dev_private; -/* get bl_max_freq and pol from dev_priv*/ -if (!dev_priv->lvds_bl) { -DRM_ERROR ("Has no valid LVDS backlight info\n" ); -return 1 ; +if (IS_MRST (dev)) { + dev_priv->blc_adj1 =BLC_ADJUSTMENT_MAX ; + dev_priv->blc_adj2 =BLC_ADJUSTMENT_MAX ; + bl_max_freq =256 ; +/* this needs to be set elsewhere */ + blc_pol =BLC_POLARITY_NORMAL ; + blc_pwm_precision_factor =BLC_PWM_PRECISION_FACTOR ; + }else { +/* get bl_max_freq and pol from dev_priv*/ +if (!dev_priv->lvds_bl) { +DRM_ERROR ("Has no valid LVDS backlight info\n" ); +return 1 ; + } + bl_max_freq = dev_priv->lvds_bl->freq; + blc_pol = dev_priv->lvds_bl->pol; + blc_pwm_precision_factor =PSB_BLC_PWM_PRECISION_FACTOR ; + blc_brightnesscmd = dev_priv->lvds_bl->brightnesscmd; + blc_type = dev_priv->lvds_bl->type; } - bl_max_freq = dev_priv->lvds_bl->freq; - blc_pol = dev_priv->lvds_bl->pol; - blc_pwm_precision_factor =PSB_BLC_PWM_PRECISION_FACTOR ; - blc_brightnesscmd = dev_priv->lvds_bl->brightnesscmd; - blc_type = dev_priv->lvds_bl->type; core_clock = dev_priv->core_freq;
@@ -113,16 +163,24 @@ static int device_backlight_init(struct drm_device *dev)if (ospm_power_using_hw_begin (OSPM_DISPLAY_ISLAND ,OSPM_UHB_ONLY_IF_ON )) { -/* Check: may be MFLD only */ -if ( - value > (unsigned long long )PSB_BLC_MAX_PWM_REG_FREQ || - value < (unsigned long long )PSB_BLC_MIN_PWM_REG_FREQ ) -return 2 ; -else { - value &=PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR ; -REG_WRITE (BLC_PWM_CTL , - (value <<PSB_BACKLIGHT_PWM_CTL_SHIFT ) | - (value)); +if (IS_MRST (dev)) { +if (value > (unsigned long long )MRST_BLC_MAX_PWM_REG_FREQ ) +return 2 ; +else { +REG_WRITE (BLC_PWM_CTL2 , + (0x80000000 |REG_READ (BLC_PWM_CTL2 ))); +REG_WRITE (BLC_PWM_CTL , value | (value <<16 )); + } + }else { +if (value > (unsigned long long )PSB_BLC_MAX_PWM_REG_FREQ || + value < (unsigned long long )PSB_BLC_MIN_PWM_REG_FREQ ) +return 2 ; +else { + value &=PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR ; +REG_WRITE (BLC_PWM_CTL , + (value <<PSB_BACKLIGHT_PWM_CTL_SHIFT ) | + (value)); + } }ospm_power_using_hw_end (OSPM_DISPLAY_ISLAND ); }
@@ -136,7 +194,7 @@ int psb_backlight_init(struct drm_device *dev)struct backlight_properties props;memset (&props,0 ,sizeof (struct backlight_properties )); - props.max_brightness =BRIGHTNESS_MAX_LEVEL ; + props.max_brightness =100 ; psb_backlight_device =backlight_device_register ("psb-bl" ,NULL , (void *)dev, &psb_ops, &props);
@@ -147,8 +205,8 @@ int psb_backlight_init(struct drm_device *dev)if (ret <0 )return ret; - psb_backlight_device->props.brightness =BRIGHTNESS_MAX_LEVEL ; - psb_backlight_device->props.max_brightness =BRIGHTNESS_MAX_LEVEL ; + psb_backlight_device->props.brightness =100 ; + psb_backlight_device->props.max_brightness =100 ;backlight_update_status (psb_backlight_device);#endif return 0 ;
Re: [PATCH 07/18] gma500: Add Moorestown backlight support
drivers/staging/gma500/psb_bl.c int psb_set_brightness(struct backlight_device *bd) · line 63
Quoted 3 lines · Alan Cox
drivers/staging/gma500/psb_bl.c +3
-0+/* Percentage 1-100% being valid */ +if (level <1 ) + level =1 ;
I know you're not actually changing anything here, but opregion supports requesting brightnesses between 0 and 255 - it'd be easier if we only had one level of scaling, rather than having to map that to a percentage only for it to be remapped to the hardware.
Signature · 1 line
Matthew Garrett | [email protected]
PATCH 8/18 gma500: add framebuffer setup
In reply to Alan CoxFor Moorestown we want to use the mrst LVDS setup not the Poulsbo setup
---
drivers/staging/gma500/psb_fb.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
drivers/staging/gma500/psb_fb.c +13 -6
@@ -698,8 +698,16 @@ static void psb_setup_outputs(struct drm_device *dev)psb_create_backlight_property (dev); -psb_intel_lvds_init (dev, &dev_priv->mode_dev); -/* psb_intel_sdvo_init(dev, SDVOB); */ +if (IS_MRST (dev)) { +if (dev_priv->iLVDS_enable) +mrst_lvds_init (dev, &dev_priv->mode_dev); +else +DRM_ERROR ("DSI is not supported\n" ); + }else { +/* FIXME: check if SDVO init should be re-enabled */ +psb_intel_lvds_init (dev, &dev_priv->mode_dev); +/* psb_intel_sdvo_init(dev, SDVOB); */ + }list_for_each_entry (connector, &dev->mode_config.connector_list, head) {
@@ -717,10 +725,9 @@ static void psb_setup_outputs(struct drm_device *dev)case INTEL_OUTPUT_LVDS :PSB_DEBUG_ENTRY ("LVDS.\n" );if (IS_MRST (dev)) - crtc_mask = (1 <<0 ); -else - crtc_mask = (1 <<1 ); - + crtc_mask = (1 <<0 ); +else + crtc_mask = (1 <<1 ); clone_mask = (1 <<INTEL_OUTPUT_LVDS );break ;case INTEL_OUTPUT_MIPI :
PATCH 9/18 gma500: enable Moorestown CRTC handling
In reply to Alan Cox---
drivers/staging/gma500/psb_intel_display.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/staging/gma500/psb_intel_display.c +6 -4
@@ -569,9 +569,7 @@ static int psb_intel_panel_fitter_pipe(struct drm_device *dev)if ((pfit_control &PFIT_ENABLE ) ==0 )return -1 ;/* Must be on PIPE 1 for PSB */ -if (!IS_MRST (dev)) -return 1 ; -return (pfit_control >>29 ) &3 ; +return 1 ; } static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
@@ -1395,7 +1393,11 @@ void psb_intel_crtc_init(struct drm_device *dev, int pipe, psb_intel_crtc->mode_dev = mode_dev; psb_intel_crtc->cursor_addr =0 ; -drm_crtc_helper_add (&psb_intel_crtc->base, +if (IS_MRST (dev)) +drm_crtc_helper_add (&psb_intel_crtc->base, + &mrst_helper_funcs); +else +drm_crtc_helper_add (&psb_intel_crtc->base, &psb_intel_helper_funcs);/* Setup the array of drm_connector pointer array */
PATCH 10/18 gma500: Moorestown does its setup differently
In reply to Alan CoxGrovel the firmware via the Moorestown interfaces and read the other bits off the fuses.
---
drivers/staging/gma500/psb_drv.c | 241 ++++++++++++++++++++++++++++++++++---- 1 files changed, 213 insertions(+), 28 deletions(-)
drivers/staging/gma500/psb_drv.c +213 -28
@@ -320,6 +320,210 @@ static void psb_do_takedown(struct drm_device *dev) } +void mrst_get_fuse_settings (struct drm_device *dev) +{ +struct drm_psb_private *dev_priv = dev->dev_private; +struct pci_dev *pci_root =pci_get_bus_and_slot (0 ,0 ); +uint32_t fuse_value =0 ; +uint32_t fuse_value_tmp =0 ; + +#define FB_REG06 0xD0810600 +#define FB_MIPI_DISABLE (1 << 11) +#define FB_REG09 0xD0810900 +#define FB_REG09 0xD0810900 +#define FB_SKU_MASK 0x7000 +#define FB_SKU_SHIFT 12 +#define FB_SKU_100 0 +#define FB_SKU_100L 1 +#define FB_SKU_83 2 +pci_write_config_dword (pci_root,0xD0 ,FB_REG06 ); +pci_read_config_dword (pci_root,0xD4 , &fuse_value); + + dev_priv->iLVDS_enable = fuse_value &FB_MIPI_DISABLE ; + +DRM_INFO ("internal display is %s\n" , + dev_priv->iLVDS_enable ?"LVDS display" :"MIPI display" ); + +/*prevent Runtime suspend at start*/ +if (dev_priv->iLVDS_enable) { + dev_priv->is_lvds_on = true; + dev_priv->is_mipi_on = false; + } +else { + dev_priv->is_mipi_on = true; + dev_priv->is_lvds_on = false; + } + + dev_priv->video_device_fuse = fuse_value; + +pci_write_config_dword (pci_root,0xD0 ,FB_REG09 ); +pci_read_config_dword (pci_root,0xD4 , &fuse_value); + +DRM_INFO ("SKU values is 0x%x. \n" , fuse_value); + fuse_value_tmp = (fuse_value &FB_SKU_MASK ) >>FB_SKU_SHIFT ; + + dev_priv->fuse_reg_value = fuse_value; + +switch (fuse_value_tmp) { +case FB_SKU_100 : + dev_priv->core_freq =200 ; +break ; +case FB_SKU_100L : + dev_priv->core_freq =100 ; +break ; +case FB_SKU_83 : + dev_priv->core_freq =166 ; +break ; +default : +DRM_ERROR ("Invalid SKU values, SKU value = 0x%08x\n" , fuse_value_tmp); + dev_priv->core_freq =0 ; + } +DRM_INFO ("LNC core clk is %dMHz.\n" , dev_priv->core_freq); +pci_dev_put (pci_root); +} + +void mid_get_pci_revID (struct drm_psb_private *dev_priv) +{ +uint32_t platform_rev_id =0 ; +struct pci_dev *pci_gfx_root =pci_get_bus_and_slot (0 ,PCI_DEVFN (2 ,0 )); + +/*get the revison ID, B0:D2:F0;0x08 */ +pci_read_config_dword (pci_gfx_root,0x08 , &platform_rev_id); + dev_priv->platform_rev_id = (uint8_t ) platform_rev_id; +pci_dev_put (pci_gfx_root); +PSB_DEBUG_ENTRY ("platform_rev_id is %x\n" , dev_priv->platform_rev_id); +} + +void mrst_get_vbt_data (struct drm_psb_private *dev_priv) +{ +struct mrst_vbt *vbt = &dev_priv->vbt_data; +u32 platform_config_address; +u16 new_size; +u8 *vbt_virtual; +u8 bpi; +u8 number_desc =0 ; +struct mrst_timing_info *dp_ti = &dev_priv->gct_data.DTD; +struct gct_r10_timing_info ti; +void *pGCT; +struct pci_dev *pci_gfx_root =pci_get_bus_and_slot (0 ,PCI_DEVFN (2 ,0 )); + +/*get the address of the platform config vbt, B0:D2:F0;0xFC */ +pci_read_config_dword (pci_gfx_root,0xFC , &platform_config_address); +pci_dev_put (pci_gfx_root); +DRM_INFO ("drm platform config address is %x\n" , + platform_config_address); + +/* check for platform config address == 0. */ +/* this means fw doesn't support vbt */ + +if (platform_config_address ==0 ) { + vbt->size =0 ; +return ; + } + +/* get the virtual address of the vbt */ + vbt_virtual =ioremap (platform_config_address,sizeof (*vbt)); + +memcpy (vbt, vbt_virtual,sizeof (*vbt)); +iounmap (vbt_virtual);/* Free virtual address space */ + +printk (KERN_ALERT "GCT revision is %x\n" , vbt->revision); + +switch (vbt->revision) { +case 0 : + vbt->mrst_gct =NULL ; + vbt->mrst_gct = \ +ioremap (platform_config_address +sizeof (*vbt) -4 , + vbt->size -sizeof (*vbt) +4 ); + pGCT = vbt->mrst_gct; + bpi = ((struct mrst_gct_v1 *)pGCT)->PD.BootPanelIndex; + dev_priv->gct_data.bpi = bpi; + dev_priv->gct_data.pt = + ((struct mrst_gct_v1 *)pGCT)->PD.PanelType; +memcpy (&dev_priv->gct_data.DTD, + &((struct mrst_gct_v1 *)pGCT)->panel[bpi].DTD, +sizeof (struct mrst_timing_info )); + dev_priv->gct_data.Panel_Port_Control = + ((struct mrst_gct_v1 *)pGCT)->panel[bpi].Panel_Port_Control; + dev_priv->gct_data.Panel_MIPI_Display_Descriptor = + ((struct mrst_gct_v1 *)pGCT)->panel[bpi].Panel_MIPI_Display_Descriptor; +break ; +case 1 : + vbt->mrst_gct =NULL ; + vbt->mrst_gct = \ +ioremap (platform_config_address +sizeof (*vbt) -4 , + vbt->size -sizeof (*vbt) +4 ); + pGCT = vbt->mrst_gct; + bpi = ((struct mrst_gct_v2 *)pGCT)->PD.BootPanelIndex; + dev_priv->gct_data.bpi = bpi; + dev_priv->gct_data.pt = + ((struct mrst_gct_v2 *)pGCT)->PD.PanelType; +memcpy (&dev_priv->gct_data.DTD, + &((struct mrst_gct_v2 *)pGCT)->panel[bpi].DTD, +sizeof (struct mrst_timing_info )); + dev_priv->gct_data.Panel_Port_Control = + ((struct mrst_gct_v2 *)pGCT)->panel[bpi].Panel_Port_Control; + dev_priv->gct_data.Panel_MIPI_Display_Descriptor = + ((struct mrst_gct_v2 *)pGCT)->panel[bpi].Panel_MIPI_Display_Descriptor; +break ; +case 0x10 : +/*header definition changed from rev 01 (v2) to rev 10h. */ +/*so, some values have changed location*/ + new_size = vbt->checksum;/*checksum contains lo size byte*/ +/*LSB of mrst_gct contains hi size byte*/ + new_size |= ((0xff & (unsigned int )vbt->mrst_gct)) <<8 ; + + vbt->checksum = vbt->size;/*size contains the checksum*/ +if (new_size >0xff ) + vbt->size =0xff ;/*restrict size to 255*/ +else + vbt->size = new_size; + +/* number of descriptors defined in the GCT */ + number_desc = ((0xff00 & (unsigned int )vbt->mrst_gct)) >>8 ; + bpi = ((0xff0000 & (unsigned int )vbt->mrst_gct)) >>16 ; + vbt->mrst_gct =NULL ; + vbt->mrst_gct = \ +ioremap (platform_config_address +GCT_R10_HEADER_SIZE , +GCT_R10_DISPLAY_DESC_SIZE * number_desc); + pGCT = vbt->mrst_gct; + pGCT = (u8 *)pGCT + (bpi*GCT_R10_DISPLAY_DESC_SIZE ); + dev_priv->gct_data.bpi = bpi;/*save boot panel id*/ + +/*copy the GCT display timings into a temp structure*/ +memcpy (&ti, pGCT,sizeof (struct gct_r10_timing_info )); + +/*now copy the temp struct into the dev_priv->gct_data*/ + dp_ti->pixel_clock = ti.pixel_clock; + dp_ti->hactive_hi = ti.hactive_hi; + dp_ti->hactive_lo = ti.hactive_lo; + dp_ti->hblank_hi = ti.hblank_hi; + dp_ti->hblank_lo = ti.hblank_lo; + dp_ti->hsync_offset_hi = ti.hsync_offset_hi; + dp_ti->hsync_offset_lo = ti.hsync_offset_lo; + dp_ti->hsync_pulse_width_hi = ti.hsync_pulse_width_hi; + dp_ti->hsync_pulse_width_lo = ti.hsync_pulse_width_lo; + dp_ti->vactive_hi = ti.vactive_hi; + dp_ti->vactive_lo = ti.vactive_lo; + dp_ti->vblank_hi = ti.vblank_hi; + dp_ti->vblank_lo = ti.vblank_lo; + dp_ti->vsync_offset_hi = ti.vsync_offset_hi; + dp_ti->vsync_offset_lo = ti.vsync_offset_lo; + dp_ti->vsync_pulse_width_hi = ti.vsync_pulse_width_hi; + dp_ti->vsync_pulse_width_lo = ti.vsync_pulse_width_lo; + +/*mov the MIPI_Display_Descriptor data from GCT to dev priv*/ + dev_priv->gct_data.Panel_MIPI_Display_Descriptor = + *((u8 *)pGCT +0x0d ); + dev_priv->gct_data.Panel_MIPI_Display_Descriptor |= + (*((u8 *)pGCT +0x0e )) <<8 ; +break ; +default : +printk (KERN_ERR "Unknown revision of GCT!\n" ); + vbt->size =0 ; + } +} +static void psb_get_core_freq (struct drm_device *dev) {uint32_t clock;
@@ -358,31 +562,6 @@ static void psb_get_core_freq(struct drm_device *dev) } } -#define FB_REG06 0xD0810600 -#define FB_TOPAZ_DISABLE BIT0 -#define FB_MIPI_DISABLE BIT11 -#define FB_REG09 0xD0810900 -#define FB_SKU_MASK (BIT12|BIT13|BIT14) -#define FB_SKU_SHIFT 12 -#define FB_SKU_100 0 -#define FB_SKU_100L 1 -#define FB_SKU_83 2 - -bool mid_get_pci_revID (struct drm_psb_private *dev_priv) -{ -uint32_t platform_rev_id =0 ; -struct pci_dev *pci_gfx_root =pci_get_bus_and_slot (0 ,PCI_DEVFN (2 ,0 )); - -/*get the revison ID, B0:D2:F0;0x08 */ -pci_read_config_dword (pci_gfx_root,0x08 , &platform_rev_id); - dev_priv->platform_rev_id = (uint8_t ) platform_rev_id; -pci_dev_put (pci_gfx_root); -PSB_DEBUG_ENTRY ("platform_rev_id is %x\n" , - dev_priv->platform_rev_id); - -return true; -} -static int psb_do_init (struct drm_device *dev) { struct drm_psb_private *dev_priv =
@@ -634,9 +813,15 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)if (!dev_priv->sgx_reg) goto out_err; -psb_get_core_freq (dev); -psb_intel_opregion_init (dev); -psb_intel_init_bios (dev); +if (IS_MRST (dev)) { +mrst_get_fuse_settings (dev); +mrst_get_vbt_data (dev_priv); +mid_get_pci_revID (dev_priv); + }else { +psb_get_core_freq (dev); +psb_intel_opregion_init (dev); +psb_intel_init_bios (dev); + }PSB_DEBUG_INIT ("Init TTM fence and BO driver\n" );
PATCH 11/18 gma500: Add Moorestown identifiers
In reply to Alan CoxTurn it on, turn it up, turn it loose
---
drivers/staging/gma500/psb_drv.c | 8 ++++++++ drivers/staging/gma500/psb_drv.h | 1 + 2 files changed, 9 insertions(+), 0 deletions(-)
drivers/staging/gma500/psb_drv.c +8 -0
@@ -62,6 +62,14 @@ module_param_named(rtpm, gfxrtdelay, int, 0600);static struct pci_device_id pciidlist[] = { {0x8086 ,0x8108 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_PSB_8108 }, {0x8086 ,0x8109 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_PSB_8109 }, + {0x8086 ,0x4100 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_MRST_4100 }, + {0x8086 ,0x4101 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_MRST_4100 }, + {0x8086 ,0x4102 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_MRST_4100 }, + {0x8086 ,0x4103 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_MRST_4100 }, + {0x8086 ,0x4104 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_MRST_4100 }, + {0x8086 ,0x4105 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_MRST_4100 }, + {0x8086 ,0x4106 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_MRST_4100 }, + {0x8086 ,0x4107 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,CHIP_MRST_4100 }, {0 ,0 ,0 } };MODULE_DEVICE_TABLE (pci, pciidlist);
drivers/staging/gma500/psb_drv.h +1 -0
@@ -43,6 +43,7 @@ extern struct ttm_bo_driver psb_ttm_bo_driver;enum {CHIP_PSB_8108 =0 ,CHIP_PSB_8109 =1 , +CHIP_MRST_4100 =2 , };#define IS_MRST (dev) (((dev)->pci_device & 0xfffc) == 0x4100)
PATCH 12/18 gma500: delete the RAR handling
In reply to Alan CoxRAR registers are used on MID platforms for various protected video playback activities using video playback engines we don't support.
So Rasputin can keep his Rars
---
drivers/staging/gma500/psb_buffer.c | 16 +--------------- drivers/staging/gma500/psb_drv.c | 29 +---------------------------- drivers/staging/gma500/psb_drv.h | 6 ------ drivers/staging/gma500/psb_gtt.c | 22 ---------------------- 4 files changed, 2 insertions(+), 71 deletions(-)
drivers/staging/gma500/psb_buffer.c +1 -15
@@ -76,14 +76,6 @@ static int psb_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, man->available_caching =TTM_PL_FLAG_UNCACHED ; man->default_caching =TTM_PL_FLAG_UNCACHED ;break ; -case TTM_PL_RAR :/* Unmappable RAR memory */ - man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_MAPPABLE | -TTM_MEMTYPE_FLAG_FIXED ; - man->available_caching =TTM_PL_FLAG_UNCACHED ; - man->default_caching =TTM_PL_FLAG_UNCACHED ; - man->gpu_offset = pg->mmu_gatt_start + (pg->rar_start); -break ;case TTM_PL_TT :/* Mappable GATT memory */ man->func = &ttm_bo_manager_func;#ifdef PSB_WORKING_HOST_MMU_ACCESS
@@ -95,8 +87,7 @@ static int psb_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, man->available_caching =TTM_PL_FLAG_CACHED |TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; - man->gpu_offset = pg->mmu_gatt_start + - (pg->rar_start + dev_priv->rar_region_size); + man->gpu_offset = pg->mmu_gatt_start;break ;default :DRM_ERROR ("Unsupported memory type %u\n" , (unsigned ) type);
@@ -387,11 +378,6 @@ static int psb_ttm_io_mem_reserve(struct ttm_bo_device *bdev, mem->bus.base = dev_priv->ci_region_start;; mem->bus.is_iomem = true;break ; -case TTM_PL_RAR : - mem->bus.offset = mm_node->start <<PAGE_SHIFT ; - mem->bus.base = dev_priv->rar_region_start;; - mem->bus.is_iomem = true; -break ;default :return -EINVAL ; }
drivers/staging/gma500/psb_drv.c +1 -28
@@ -321,11 +321,6 @@ static void psb_do_takedown(struct drm_device *dev)ttm_bo_clean_mm (bdev,TTM_PL_CI ); dev_priv->have_camera =0 ; } -if (dev_priv->have_rar) { -ttm_bo_clean_mm (bdev,TTM_PL_RAR ); - dev_priv->have_rar =0 ; - } - }void mrst_get_fuse_settings (struct drm_device *dev)
@@ -647,7 +642,7 @@ static int psb_do_init(struct drm_device *dev)if (!ttm_bo_init_mm (bdev,TTM_PL_TT , pg->gatt_pages - (pg->ci_start >>PAGE_SHIFT ) - - ((dev_priv->ci_region_size + dev_priv->rar_region_size) + ((dev_priv->ci_region_size) >>PAGE_SHIFT ))) { dev_priv->have_tt =1 ;
@@ -707,12 +702,6 @@ static int psb_driver_unload(struct drm_device *dev) (dev_priv->mmu), pg->ci_start, pg->ci_stolen_size >> PAGE_SHIFT); -if (pg->rar_stolen_size !=0 ) -psb_mmu_remove_pfn_sequence ( -psb_mmu_get_default_pd - (dev_priv->mmu), - pg->rar_start, - pg->rar_stolen_size >>PAGE_SHIFT );up_read (&pg->sem);psb_mmu_driver_takedown (dev_priv->mmu); dev_priv->mmu =NULL ;
@@ -883,7 +872,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)/* CI/RAR use the lower half of TT. */ pg->ci_start = (tt_pages /2 ) <<PAGE_SHIFT ; - pg->rar_start = pg->ci_start + pg->ci_stolen_size;/*
@@ -901,21 +889,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) goto out_err; } -/* -* Make MSVDX/TOPAZ MMU aware of the rar stolen memory area. -*/ -if (dev_priv->pg->rar_stolen_size !=0 ) { -down_read (&pg->sem); - ret =psb_mmu_insert_pfn_sequence ( -psb_mmu_get_default_pd (dev_priv->mmu), - dev_priv->rar_region_start >>PAGE_SHIFT , - pg->mmu_gatt_start + pg->rar_start, - pg->rar_stolen_size >>PAGE_SHIFT ,0 ); -up_read (&pg->sem); -if (ret) - goto out_err; - } - dev_priv->pf_pd =psb_mmu_alloc_pd (dev_priv->mmu,1 ,0 );if (!dev_priv->pf_pd) goto out_err;
drivers/staging/gma500/psb_drv.h +0 -6
@@ -606,12 +606,6 @@ struct drm_psb_private {unsigned int ci_region_size;/* -* RAR share buffer; -*/ -unsigned int rar_region_start; -unsigned int rar_region_size; - -/* *Memory managers */
drivers/staging/gma500/psb_gtt.c +0 -22
@@ -76,7 +76,6 @@ int psb_gtt_init(struct psb_gtt *pg, int resume)struct drm_psb_private *dev_priv = dev->dev_private;unsigned gtt_pages;unsigned long stolen_size, vram_stolen_size, ci_stolen_size; -unsigned long rar_stolen_size;unsigned i, num_pages;unsigned pfn_base;uint32_t ci_pages, vram_pages;
@@ -118,8 +117,6 @@ int psb_gtt_init(struct psb_gtt *pg, int resume)* managed by TTM to stolen_size */ stolen_size = vram_stolen_size; - rar_stolen_size = dev_priv->rar_region_size; -printk (KERN_INFO "GMMADR(region 0) start: 0x%08x (%dM).\n" , pg->gatt_start, pg->gatt_pages/256 ); printk(KERN_INFO"GTTADR(region 3) start: 0x%08x (can map %dM RAM), and actual RAM base 0x%08x.\n",
@@ -136,10 +133,6 @@ int psb_gtt_init(struct psb_gtt *pg, int resume)printk (KERN_INFO "CI Stole memory: RAM base = 0x%08x, size = %lu M\n" , dev_priv->ci_region_start, ci_stolen_size /1024 /1024 ); -if (rar_stolen_size >0 ) -printk (KERN_INFO "RAR Stole memory: RAM base = 0x%08x, size = %lu M\n" , - dev_priv->rar_region_start, - rar_stolen_size /1024 /1024 );if (resume && (gtt_pages != pg->gtt_pages) && (stolen_size != pg->stolen_size)) {
@@ -152,7 +145,6 @@ int psb_gtt_init(struct psb_gtt *pg, int resume) pg->stolen_size = stolen_size; pg->vram_stolen_size = vram_stolen_size; pg->ci_stolen_size = ci_stolen_size; - pg->rar_stolen_size = rar_stolen_size; pg->gtt_map =ioremap_nocache (pg->gtt_phys_start, gtt_pages <<PAGE_SHIFT );if (!pg->gtt_map) {
@@ -210,20 +202,6 @@ int psb_gtt_init(struct psb_gtt *pg, int resume) }/* -* insert RAR stolen pages -*/ -if (rar_stolen_size !=0 ) { - pfn_base = dev_priv->rar_region_start >>PAGE_SHIFT ; - num_pages = rar_stolen_size >>PAGE_SHIFT ; -printk (KERN_INFO "Set up %d RAR stolen pages starting at 0x%08x, GTT offset %dK\n" , - num_pages, pfn_base, - (ttm_gtt_map - pg->gtt_map + i) *4 ); -for (; i < num_pages + ci_pages; ++i) { - pte =psb_gtt_mask_pte (pfn_base + i - ci_pages,0 ); -iowrite32 (pte, ttm_gtt_map + i); - } - } -/* * Init rest of gtt managed by TTM. */
PATCH 13/18 gma500: We don't support the CI either
In reply to Alan CoxThe camera interface is also not covered (and we won't be using TTM anyway even if it ever re-emerges) so it to can go
---
drivers/staging/gma500/psb_buffer.c | 13 ------------- drivers/staging/gma500/psb_drv.c | 36 +---------------------------------- drivers/staging/gma500/psb_drv.h | 8 -------- drivers/staging/gma500/psb_gtt.c | 27 ++------------------------ drivers/staging/gma500/psb_gtt.h | 4 ---- 5 files changed, 3 insertions(+), 85 deletions(-)
drivers/staging/gma500/psb_buffer.c +0 -13
@@ -68,14 +68,6 @@ static int psb_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ;break ; -case TTM_PL_CI : - man->func = &ttm_bo_manager_func; - man->flags =TTM_MEMTYPE_FLAG_MAPPABLE | -TTM_MEMTYPE_FLAG_FIXED ; - man->gpu_offset = pg->mmu_gatt_start + (pg->ci_start); - man->available_caching =TTM_PL_FLAG_UNCACHED ; - man->default_caching =TTM_PL_FLAG_UNCACHED ; -break ;case TTM_PL_TT :/* Mappable GATT memory */ man->func = &ttm_bo_manager_func;#ifdef PSB_WORKING_HOST_MMU_ACCESS
@@ -373,11 +365,6 @@ static int psb_ttm_io_mem_reserve(struct ttm_bo_device *bdev, mem->bus.offset = mm_node->start <<PAGE_SHIFT ; mem->bus.base =0x00000000 ;break ; -case TTM_PL_CI : - mem->bus.offset = mm_node->start <<PAGE_SHIFT ; - mem->bus.base = dev_priv->ci_region_start;; - mem->bus.is_iomem = true; -break ;default :return -EINVAL ; }
drivers/staging/gma500/psb_drv.c +1 -35
@@ -316,11 +316,6 @@ static void psb_do_takedown(struct drm_device *dev)ttm_bo_clean_mm (bdev,TTM_PL_TT ); dev_priv->have_tt =0 ; } - -if (dev_priv->have_camera) { -ttm_bo_clean_mm (bdev,TTM_PL_CI ); - dev_priv->have_camera =0 ; - } }void mrst_get_fuse_settings (struct drm_device *dev)
@@ -639,12 +634,7 @@ static int psb_do_init(struct drm_device *dev)PSB_WSGX32 (pg->mmu_gatt_start,PSB_CR_BIF_TWOD_REQ_BASE );/* TT region managed by TTM. */ -if (!ttm_bo_init_mm (bdev,TTM_PL_TT , - pg->gatt_pages - - (pg->ci_start >>PAGE_SHIFT ) - - ((dev_priv->ci_region_size) - >>PAGE_SHIFT ))) { - +if (!ttm_bo_init_mm (bdev,TTM_PL_TT , pg->gatt_pages)) { dev_priv->have_tt =1 ; dev_priv->sizes.tt_size = (tt_pages <<PAGE_SHIFT ) / (1024 *1024 ) /2 ;
@@ -696,12 +686,6 @@ static int psb_driver_unload(struct drm_device *dev) (dev_priv->mmu), pg->mmu_gatt_start, pg->vram_stolen_size >> PAGE_SHIFT); -if (pg->ci_stolen_size !=0 ) -psb_mmu_remove_pfn_sequence ( -psb_mmu_get_default_pd - (dev_priv->mmu), - pg->ci_start, - pg->ci_stolen_size >>PAGE_SHIFT );up_read (&pg->sem);psb_mmu_driver_takedown (dev_priv->mmu); dev_priv->mmu =NULL ;
@@ -870,24 +854,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) tt_pages = (pg->gatt_pages <PSB_TT_PRIV0_PLIMIT ) ? (pg->gatt_pages) :PSB_TT_PRIV0_PLIMIT ; -/* CI/RAR use the lower half of TT. */ - pg->ci_start = (tt_pages /2 ) <<PAGE_SHIFT ; - - -/* -* Make MSVDX/TOPAZ MMU aware of the CI stolen memory area. -*/ -if (dev_priv->pg->ci_stolen_size !=0 ) { -down_read (&pg->sem); - ret =psb_mmu_insert_pfn_sequence (psb_mmu_get_default_pd - (dev_priv->mmu), - dev_priv->ci_region_start >>PAGE_SHIFT , - pg->mmu_gatt_start + pg->ci_start, - pg->ci_stolen_size >>PAGE_SHIFT ,0 ); -up_read (&pg->sem); -if (ret) - goto out_err; - } dev_priv->pf_pd =psb_mmu_alloc_pd (dev_priv->mmu,1 ,0 );if (!dev_priv->pf_pd)
drivers/staging/gma500/psb_drv.h +0 -8
@@ -600,17 +600,9 @@ struct drm_psb_private {uint32_t num_pipe;/* -* CI share buffer -*/ -unsigned int ci_region_start; -unsigned int ci_region_size; - -/* *Memory managers */ -int have_camera; -int have_rar;int have_tt;int have_mem_mmu;struct mutex temp_mem;
drivers/staging/gma500/psb_gtt.c +2 -25
@@ -75,10 +75,10 @@ int psb_gtt_init(struct psb_gtt *pg, int resume)struct drm_device *dev = pg->dev;struct drm_psb_private *dev_priv = dev->dev_private;unsigned gtt_pages; -unsigned long stolen_size, vram_stolen_size, ci_stolen_size; +unsigned long stolen_size, vram_stolen_size;unsigned i, num_pages;unsigned pfn_base; -uint32_t ci_pages, vram_pages; +uint32_t vram_pages;uint32_t tt_pages;uint32_t *ttm_gtt_map;uint32_t dvmt_mode =0 ;
@@ -111,10 +111,6 @@ int psb_gtt_init(struct psb_gtt *pg, int resume)pci_read_config_dword (dev->pdev,PSB_BSM , &pg->stolen_base); vram_stolen_size = pg->gtt_phys_start - pg->stolen_base -PAGE_SIZE ; -/* CI is not included in the stolen size since the TOPAZ MMU bug */ - ci_stolen_size = dev_priv->ci_region_size; -/* Don't add CI & RAR share buffer space -* managed by TTM to stolen_size */ stolen_size = vram_stolen_size; printk(KERN_INFO"GMMADR(region 0) start: 0x%08x (%dM).\n",
@@ -129,11 +125,6 @@ int psb_gtt_init(struct psb_gtt *pg, int resume)printk (KERN_INFO " the correct size should be: %dM(dvmt mode=%d)\n" , (dvmt_mode ==1 ) ?1 : (2 << (dvmt_mode -1 )), dvmt_mode); -if (ci_stolen_size >0 ) -printk (KERN_INFO "CI Stole memory: RAM base = 0x%08x, size = %lu M\n" , - dev_priv->ci_region_start, - ci_stolen_size /1024 /1024 ); -if (resume && (gtt_pages != pg->gtt_pages) && (stolen_size != pg->stolen_size)) {DRM_ERROR ("GTT resume error.\n" );
@@ -144,7 +135,6 @@ int psb_gtt_init(struct psb_gtt *pg, int resume) pg->gtt_pages = gtt_pages; pg->stolen_size = stolen_size; pg->vram_stolen_size = vram_stolen_size; - pg->ci_stolen_size = ci_stolen_size; pg->gtt_map =ioremap_nocache (pg->gtt_phys_start, gtt_pages <<PAGE_SHIFT );if (!pg->gtt_map) {
@@ -189,19 +179,6 @@ int psb_gtt_init(struct psb_gtt *pg, int resume)iowrite32 (pte, pg->gtt_map + i);/* -* insert CI stolen pages -*/ - - pfn_base = dev_priv->ci_region_start >>PAGE_SHIFT ; - ci_pages = num_pages = ci_stolen_size >>PAGE_SHIFT ; -printk (KERN_INFO "Set up %d CI stolen pages starting at 0x%08x, GTT offset %dK\n" , - num_pages, pfn_base, (ttm_gtt_map - pg->gtt_map) *4 ); -for (i =0 ; i < num_pages; ++i) { - pte =psb_gtt_mask_pte (pfn_base + i,0 ); -iowrite32 (pte, ttm_gtt_map + i); - } - -/* * Init rest of gtt managed by TTM. */
drivers/staging/gma500/psb_gtt.h +0 -4
@@ -29,8 +29,6 @@ struct psb_gtt {int initialized;uint32_t gatt_start;uint32_t mmu_gatt_start; -uint32_t ci_start; -uint32_t rar_start;uint32_t gtt_start;uint32_t gtt_phys_start;unsigned gtt_pages;
@@ -41,8 +39,6 @@ struct psb_gtt {u16 gmch_ctrl;unsigned long stolen_size;unsigned long vram_stolen_size; -unsigned long ci_stolen_size; -unsigned long rar_stolen_size;uint32_t *gtt_map;struct rw_semaphore sem; };
PATCH 14/18 gma500: Clean up more unused structures and code
In reply to Alan CoxWe don't need the 3D validation stuff so it and all the related gunge can depart. While we are at it prune some unused definitions.
---
drivers/staging/gma500/psb_drv.c | 16 ------ drivers/staging/gma500/psb_drv.h | 105 ------------------------------------- drivers/staging/gma500/psb_sgx.c | 107 -------------------------------------- 3 files changed, 0 insertions(+), 228 deletions(-)
drivers/staging/gma500/psb_drv.c +0 -16
@@ -284,20 +284,7 @@ static void psb_set_uopt(struct drm_psb_uopt *uopt)static void psb_lastclose (struct drm_device *dev) { -struct drm_psb_private *dev_priv = - (struct drm_psb_private *) dev->dev_private; -return ; - -if (!dev->dev_private) -return ; - -mutex_lock (&dev_priv->cmdbuf_mutex); -if (dev_priv->context.buffers) { -vfree (dev_priv->context.buffers); - dev_priv->context.buffers =NULL ; - } -mutex_unlock (&dev_priv->cmdbuf_mutex); }static void psb_do_takedown (struct drm_device *dev)
@@ -744,7 +731,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) dev_priv =kzalloc (sizeof (*dev_priv),GFP_KERNEL );if (dev_priv ==NULL )return -ENOMEM ; -INIT_LIST_HEAD (&dev_priv->video_ctx);if (IS_MRST (dev)) dev_priv->num_pipe =1 ;
@@ -767,8 +753,6 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)mutex_init (&dev_priv->temp_mem);mutex_init (&dev_priv->cmdbuf_mutex);mutex_init (&dev_priv->reset_mutex); -INIT_LIST_HEAD (&dev_priv->context.validate_list); -INIT_LIST_HEAD (&dev_priv->context.kern_validate_list);/* mutex_init(&dev_priv->dsr_mutex); */
drivers/staging/gma500/psb_drv.h +0 -105
151 lines not on this page · raw message
drivers/staging/gma500/psb_sgx.c +0 -107
113 lines not on this page · raw message
PATCH 15/18 gma500: pull mrst firmware stuff into its own header
In reply to Alan Cox---
drivers/staging/gma500/mrst.h | 217 ++++++++++++++++++++++++++++++++++++++ drivers/staging/gma500/psb_drv.h | 197 ---------------------------------- 2 files changed, 218 insertions(+), 196 deletions(-) create mode 100644 drivers/staging/gma500/mrst.h
drivers/staging/gma500/mrst.h new file +217 -0
@@ -0,0 +1,217 @@ +/************************************************************************** +* Copyright (c) 2007-2011, Intel Corporation. +* All Rights Reserved. +* +* 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. +* +**************************************************************************/ + +/* MID device specific descriptors */ + +struct mrst_vbt { +s8 signature[4 ];/*4 bytes,"$GCT" */ +u8 revision; +u8 size; +u8 checksum; +void *mrst_gct; +} __attribute__ ((packed)); + +struct mrst_timing_info { +u16 pixel_clock; +u8 hactive_lo; +u8 hblank_lo; +u8 hblank_hi:4 ; +u8 hactive_hi:4 ; +u8 vactive_lo; +u8 vblank_lo; +u8 vblank_hi:4 ; +u8 vactive_hi:4 ; +u8 hsync_offset_lo; +u8 hsync_pulse_width_lo; +u8 vsync_pulse_width_lo:4 ; +u8 vsync_offset_lo:4 ; +u8 vsync_pulse_width_hi:2 ; +u8 vsync_offset_hi:2 ; +u8 hsync_pulse_width_hi:2 ; +u8 hsync_offset_hi:2 ; +u8 width_mm_lo; +u8 height_mm_lo; +u8 height_mm_hi:4 ; +u8 width_mm_hi:4 ; +u8 hborder; +u8 vborder; +u8 unknown0:1 ; +u8 hsync_positive:1 ; +u8 vsync_positive:1 ; +u8 separate_sync:2 ; +u8 stereo:1 ; +u8 unknown6:1 ; +u8 interlaced:1 ; +} __attribute__((packed)); + +struct gct_r10_timing_info { +u16 pixel_clock; +u32 hactive_lo:8 ; +u32 hactive_hi:4 ; +u32 hblank_lo:8 ; +u32 hblank_hi:4 ; +u32 hsync_offset_lo:8 ; +u16 hsync_offset_hi:2 ; +u16 hsync_pulse_width_lo:8 ; +u16 hsync_pulse_width_hi:2 ; +u16 hsync_positive:1 ; +u16 rsvd_1:3 ; +u8 vactive_lo:8 ; +u16 vactive_hi:4 ; +u16 vblank_lo:8 ; +u16 vblank_hi:4 ; +u16 vsync_offset_lo:4 ; +u16 vsync_offset_hi:2 ; +u16 vsync_pulse_width_lo:4 ; +u16 vsync_pulse_width_hi:2 ; +u16 vsync_positive:1 ; +u16 rsvd_2:3 ; +} __attribute__((packed)); + +struct mrst_panel_descriptor_v1 { +u32 Panel_Port_Control;/* 1 dword, Register 0x61180 if LVDS */ +/* 0x61190 if MIPI */ +u32 Panel_Power_On_Sequencing;/*1 dword,Register 0x61208,*/ +u32 Panel_Power_Off_Sequencing;/*1 dword,Register 0x6120C,*/ +u32 Panel_Power_Cycle_Delay_and_Reference_Divisor;/* 1 dword */ +/* Register 0x61210 */ +struct mrst_timing_info DTD;/*18 bytes, Standard definition */ +u16 Panel_Backlight_Inverter_Descriptor;/* 16 bits, as follows */ +/* Bit 0, Frequency, 15 bits,0 - 32767Hz */ +/* Bit 15, Polarity, 1 bit, 0: Normal, 1: Inverted */ +u16 Panel_MIPI_Display_Descriptor; +/*16 bits, Defined as follows: */ +/* if MIPI, 0x0000 if LVDS */ +/* Bit 0, Type, 2 bits, */ +/* 0: Type-1, */ +/* 1: Type-2, */ +/* 2: Type-3, */ +/* 3: Type-4 */ +/* Bit 2, Pixel Format, 4 bits */ +/* Bit0: 16bpp (not supported in LNC), */ +/* Bit1: 18bpp loosely packed, */ +/* Bit2: 18bpp packed, */ +/* Bit3: 24bpp */ +/* Bit 6, Reserved, 2 bits, 00b */ +/* Bit 8, Minimum Supported Frame Rate, 6 bits, 0 - 63Hz */ +/* Bit 14, Reserved, 2 bits, 00b */ +} __attribute__ ((packed)); + +struct mrst_panel_descriptor_v2 { +u32 Panel_Port_Control;/* 1 dword, Register 0x61180 if LVDS */ +/* 0x61190 if MIPI */ +u32 Panel_Power_On_Sequencing;/*1 dword,Register 0x61208,*/ +u32 Panel_Power_Off_Sequencing;/*1 dword,Register 0x6120C,*/ +u8 Panel_Power_Cycle_Delay_and_Reference_Divisor;/* 1 byte */ +/* Register 0x61210 */ +struct mrst_timing_info DTD;/*18 bytes, Standard definition */ +u16 Panel_Backlight_Inverter_Descriptor;/*16 bits, as follows*/ +/*Bit 0, Frequency, 16 bits, 0 - 32767Hz*/ +u8 Panel_Initial_Brightness;/* [7:0] 0 - 100% */ +/*Bit 7, Polarity, 1 bit,0: Normal, 1: Inverted*/ +u16 Panel_MIPI_Display_Descriptor; +/*16 bits, Defined as follows: */ +/* if MIPI, 0x0000 if LVDS */ +/* Bit 0, Type, 2 bits, */ +/* 0: Type-1, */ +/* 1: Type-2, */ +/* 2: Type-3, */ +/* 3: Type-4 */ +/* Bit 2, Pixel Format, 4 bits */ +/* Bit0: 16bpp (not supported in LNC), */ +/* Bit1: 18bpp loosely packed, */ +/* Bit2: 18bpp packed, */ +/* Bit3: 24bpp */ +/* Bit 6, Reserved, 2 bits, 00b */ +/* Bit 8, Minimum Supported Frame Rate, 6 bits, 0 - 63Hz */ +/* Bit 14, Reserved, 2 bits, 00b */ +} __attribute__ ((packed)); + +union mrst_panel_rx { +struct { +u16 NumberOfLanes:2 ;/*Num of Lanes, 2 bits,0 = 1 lane,*/ +/* 1 = 2 lanes, 2 = 3 lanes, 3 = 4 lanes. */ +u16 MaxLaneFreq:3 ;/* 0: 100MHz, 1: 200MHz, 2: 300MHz, */ +/*3: 400MHz, 4: 500MHz, 5: 600MHz, 6: 700MHz, 7: 800MHz.*/ +u16 SupportedVideoTransferMode:2 ;/*0: Non-burst only */ +/* 1: Burst and non-burst */ +/* 2/3: Reserved */ +u16 HSClkBehavior:1 ;/*0: Continuous, 1: Non-continuous*/ +u16 DuoDisplaySupport:1 ;/*1 bit,0: No, 1: Yes*/ +u16 ECC_ChecksumCapabilities:1 ;/*1 bit,0: No, 1: Yes*/ +u16 BidirectionalCommunication:1 ;/*1 bit,0: No, 1: Yes */ +u16 Rsvd:5 ;/*5 bits,00000b */ + } panelrx; +u16 panel_receiver; +} __attribute__ ((packed)); + +struct mrst_gct_v1 { +union {/*8 bits,Defined as follows: */ +struct { +u8 PanelType:4 ;/*4 bits, Bit field for panels*/ +/* 0 - 3: 0 = LVDS, 1 = MIPI*/ +/*2 bits,Specifies which of the*/ +u8 BootPanelIndex:2 ; +/* 4 panels to use by default*/ +u8 BootMIPI_DSI_RxIndex:2 ;/*Specifies which of*/ +/* the 4 MIPI DSI receivers to use*/ + } PD; +u8 PanelDescriptor; + }; +struct mrst_panel_descriptor_v1 panel[4 ];/*panel descrs,38 bytes each*/ +union mrst_panel_rx panelrx[4 ];/* panel receivers*/ +} __attribute__ ((packed)); + +struct mrst_gct_v2 { +union {/*8 bits,Defined as follows: */ +struct { +u8 PanelType:4 ;/*4 bits, Bit field for panels*/ +/* 0 - 3: 0 = LVDS, 1 = MIPI*/ +/*2 bits,Specifies which of the*/ +u8 BootPanelIndex:2 ; +/* 4 panels to use by default*/ +u8 BootMIPI_DSI_RxIndex:2 ;/*Specifies which of*/ +/* the 4 MIPI DSI receivers to use*/ + } PD; +u8 PanelDescriptor; + }; +struct mrst_panel_descriptor_v2 panel[4 ];/*panel descrs,38 bytes each*/ +union mrst_panel_rx panelrx[4 ];/* panel receivers*/ +} __attribute__ ((packed)); + +struct mrst_gct_data { +u8 bpi;/* boot panel index, number of panel used during boot */ +u8 pt;/* panel type, 4 bit field, 0=lvds, 1=mipi */ +struct mrst_timing_info DTD;/* timing info for the selected panel */ +u32 Panel_Port_Control; +u32 PP_On_Sequencing;/*1 dword,Register 0x61208,*/ +u32 PP_Off_Sequencing;/*1 dword,Register 0x6120C,*/ +u32 PP_Cycle_Delay; +u16 Panel_Backlight_Inverter_Descriptor; +u16 Panel_MIPI_Display_Descriptor; +} __attribute__ ((packed)); + +#define MODE_SETTING_IN_CRTC 0x1 +#define MODE_SETTING_IN_ENCODER 0x2 +#define MODE_SETTING_ON_GOING 0x3 +#define MODE_SETTING_IN_DSR 0x4 +#define MODE_SETTING_ENCODER_DONE 0x8 +#define GCT_R10_HEADER_SIZE 16 +#define GCT_R10_DISPLAY_DESC_SIZE 28 +
drivers/staging/gma500/psb_drv.h +1 -196
209 lines not on this page · raw message
PATCH 16/18 gma500; kill off TTM
In reply to Alan CoxWe are not using TTM, we are not going to use TTM either
---
drivers/staging/gma500/Makefile | 7 drivers/staging/gma500/psb_2d.c | 1 drivers/staging/gma500/psb_buffer.c | 423 --------------- drivers/staging/gma500/psb_drm.h | 111 ---- drivers/staging/gma500/psb_drv.c | 227 +------- drivers/staging/gma500/psb_drv.h | 110 ---- drivers/staging/gma500/psb_fb.c | 5 drivers/staging/gma500/psb_fence.c | 122 ---- drivers/staging/gma500/psb_gtt.c | 2 drivers/staging/gma500/psb_sgx.c | 131 ----- drivers/staging/gma500/psb_sgx.h | 32 - drivers/staging/gma500/psb_ttm_fence.c | 605 ---------------------- drivers/staging/gma500/psb_ttm_fence_api.h | 272 ---------- drivers/staging/gma500/psb_ttm_fence_driver.h | 302 ----------- drivers/staging/gma500/psb_ttm_fence_user.c | 237 --------- drivers/staging/gma500/psb_ttm_fence_user.h | 140 ----- drivers/staging/gma500/psb_ttm_glue.c | 349 ------------- drivers/staging/gma500/psb_ttm_placement_user.c | 628 ----------------------- drivers/staging/gma500/psb_ttm_userobj_api.h | 85 --- 19 files changed, 17 insertions(+), 3772 deletions(-) delete mode 100644 drivers/staging/gma500/psb_buffer.c delete mode 100644 drivers/staging/gma500/psb_fence.c delete mode 100644 drivers/staging/gma500/psb_sgx.c delete mode 100644 drivers/staging/gma500/psb_sgx.h delete mode 100644 drivers/staging/gma500/psb_ttm_fence.c delete mode 100644 drivers/staging/gma500/psb_ttm_fence_api.h delete mode 100644 drivers/staging/gma500/psb_ttm_fence_driver.h delete mode 100644 drivers/staging/gma500/psb_ttm_fence_user.c delete mode 100644 drivers/staging/gma500/psb_ttm_fence_user.h delete mode 100644 drivers/staging/gma500/psb_ttm_glue.c delete mode 100644 drivers/staging/gma500/psb_ttm_placement_user.c delete mode 100644 drivers/staging/gma500/psb_ttm_userobj_api.h
drivers/staging/gma500/Makefile +0 -7
@@ -16,15 +16,8 @@ psb_gfx-y += psb_bl.o \ psb_intel_modes.o \ psb_intel_sdvo.o \ psb_reset.o \ - psb_sgx.o \ psb_pvr_glue.o \ - psb_buffer.o \ - psb_fence.o \ psb_mmu.o \ - psb_ttm_glue.o \ - psb_ttm_fence.o \ - psb_ttm_fence_user.o \ - psb_ttm_placement_user.o \ psb_powermgmt.o \ psb_irq.o \ mrst_crtc.o \
drivers/staging/gma500/psb_2d.c +0 -1
@@ -40,7 +40,6 @@#include "psb_reg.h" #include "psb_drv.h" #include "psb_fb.h" -#include "psb_sgx.h" void psb_spank (struct drm_psb_private *dev_priv) {
drivers/staging/gma500/psb_buffer.c deleted +0 -423
423 lines not on this page · raw message
drivers/staging/gma500/psb_drm.h +0 -111
135 lines not on this page · raw message
drivers/staging/gma500/psb_drv.c +14 -213
356 lines not on this page · raw message
drivers/staging/gma500/psb_drv.h +0 -110
161 lines not on this page · raw message
drivers/staging/gma500/psb_fb.c +2 -3
@@ -36,9 +36,7 @@#include "psb_drv.h" #include "psb_intel_reg.h" #include "psb_intel_drv.h" -#include "psb_ttm_userobj_api.h" #include "psb_fb.h" -#include "psb_sgx.h" #include "psb_pvr_glue.h" static void psb_user_framebuffer_destroy (struct drm_framebuffer *fb);
@@ -317,6 +315,8 @@ static struct drm_framebuffer *psb_user_framebuffer_create (struct drm_device *dev, struct drm_file *filp, struct drm_mode_fb_cmd *r) { +return NULL ; +#if 0 struct ttm_buffer_object *bo =NULL ;uint64_t size;
@@ -332,7 +332,6 @@ static struct drm_framebuffer *psb_user_framebuffer_create/* JB: TODO not drop, refcount buffer */ return psb_framebuffer_create (dev, r, bo); -#if 0 struct psb_framebuffer *psbfb;struct drm_framebuffer *fb;struct fb_info *info;
drivers/staging/gma500/psb_fence.c deleted +0 -122
122 lines not on this page · raw message
drivers/staging/gma500/psb_gtt.c +1 -1
@@ -101,7 +101,7 @@ int psb_gtt_init(struct psb_gtt *pg, int resume) pg->gatt_start =pci_resource_start (dev->pdev,PSB_GATT_RESOURCE );/* fix me: video mmu has hw bug to access 0x0D0000000, * then make gatt start at 0x0e000,0000 */ - pg->mmu_gatt_start =PSB_MEM_TT_START ; + pg->mmu_gatt_start =0xE0000000 ; pg->gtt_start =pci_resource_start (dev->pdev,PSB_GTT_RESOURCE ); gtt_pages =pci_resource_len (dev->pdev,PSB_GTT_RESOURCE ) >>PAGE_SHIFT ;
drivers/staging/gma500/psb_sgx.c deleted +0 -131
131 lines not on this page · raw message
drivers/staging/gma500/psb_sgx.h deleted +0 -32
@@ -1,32 +0,0 @@ -/* -* Copyright (c) 2008, 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 <[email protected]> -* -**/ -#ifndef _PSB_SGX_H_ -#define _PSB_SGX_H_ - -extern int psb_submit_video_cmdbuf (struct drm_device *dev, -struct ttm_buffer_object *cmd_buffer, -unsigned long cmd_offset, -unsigned long cmd_size, -struct ttm_fence_object *fence); - -extern int drm_idle_check_interval; - -#endif
drivers/staging/gma500/psb_ttm_fence.c deleted +0 -605
605 lines not on this page · raw message
drivers/staging/gma500/psb_ttm_fence_api.h deleted +0 -272
272 lines not on this page · raw message
drivers/staging/gma500/psb_ttm_fence_driver.h deleted +0 -302
302 lines not on this page · raw message
drivers/staging/gma500/psb_ttm_fence_user.c deleted +0 -237
237 lines not on this page · raw message
drivers/staging/gma500/psb_ttm_fence_user.h deleted +0 -140
140 lines not on this page · raw message
drivers/staging/gma500/psb_ttm_glue.c deleted +0 -349
30 lines not on this page · raw message
drivers/staging/gma500/psb_ttm_placement_user.c deleted +0 -628
628 lines not on this page · raw message
drivers/staging/gma500/psb_ttm_userobj_api.h deleted +0 -85
85 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 17/18 drivers:staging:gma500 Remove extra semi-colon.
In reply to Alan CoxFrom: \"Justin P. Mattock\" <[email protected]>
The patch below removes an extra semi-colon from various parts of the kernel. Please have a look when you have time, and let me know if its legit or not.
---
drivers/staging/gma500/psb_fb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/gma500/psb_fb.c +1 -1
@@ -192,7 +192,7 @@ static int psbfb_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)struct drm_device *dev = psbfb->base.dev;struct drm_psb_private *dev_priv = dev->dev_private;struct psb_gtt *pg = dev_priv->pg; -unsigned long phys_addr = (unsigned long )pg->stolen_base;; +unsigned long phys_addr = (unsigned long )pg->stolen_base; page_num = (vma->vm_end - vma->vm_start) >>PAGE_SHIFT ;
PATCH 18/18 gma500: turn on psb SDVO
In reply to Alan CoxKeep this as its own commit for bisection purposes
---
drivers/staging/gma500/psb_fb.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/staging/gma500/psb_fb.c +1 -2
@@ -703,9 +703,8 @@ static void psb_setup_outputs(struct drm_device *dev)else DRM_ERROR ("DSI is not supported\n" ); }else { -/* FIXME: check if SDVO init should be re-enabled */ psb_intel_lvds_init (dev, &dev_priv->mode_dev); -/* psb_intel_sdvo_init(dev, SDVOB); */ +psb_intel_sdvo_init (dev,SDVOB ); } list_for_each_entry(connector, &dev->mode_config.connector_list,
Quoted 3 lines · Alan Cox
This set of patches tackles three basic things
- Add support for Moorestown (not yet usable as it needs a memory allocator)
Is Moorestown known as GMA500 or GMA600? Is there some more generic name that would cover all of them?
(Clearly not a high-priority issue, given the set of hardware supported by the i915 driver)
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · On Wed, 30 Mar 2011 11:35:56 +0100 Matthew Garrett <[email protected]> wrote:
Quoted 4 lines · Alan Cox
This set of patches tackles three basic things
- Add support for Moorestown (not yet usable as it needs a memory allocator)
Is Moorestown known as GMA500 or GMA600? Is there some more generic name that would cover all of them?
GMA600 if I remember rightly
I'm not aware of a generic naming for them.