Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236080
b: refs/heads/master
c: 0867b42
h: refs/heads/master
v: v3
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Feb 23, 2011
1 parent bffab07 commit 84404ee
Show file tree
Hide file tree
Showing 49 changed files with 19,347 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 008536e8458613ce569595e43b0e71afa8b48ae8
refs/heads/master: 0867b42113ec4eb8646eb361b15cbcfb741ddf5b
2 changes: 2 additions & 0 deletions trunk/drivers/staging/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,7 @@ source "drivers/staging/cptm1217/Kconfig"

source "drivers/staging/ste_rmi4/Kconfig"

source "drivers/staging/gma500/Kconfig"

endif # !STAGING_EXCLUDE_BUILD
endif # STAGING
9 changes: 5 additions & 4 deletions trunk/drivers/staging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ obj-$(CONFIG_SOLO6X10) += solo6x10/
obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/
obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/
obj-$(CONFIG_WESTBRIDGE_ASTORIA) += westbridge/astoria/
obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/
obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/
obj-$(CONFIG_ATH6K_LEGACY) += ath6kl/
obj-$(CONFIG_USB_ENESTORAGE) += keucr/
obj-$(CONFIG_BCM_WIMAX) += bcm/
obj-$(CONFIG_BCM_WIMAX) += bcm/
obj-$(CONFIG_FT1000) += ft1000/
obj-$(CONFIG_SND_INTEL_SST) += intel_sst/
obj-$(CONFIG_SPEAKUP) += speakup/
obj-$(CONFIG_SND_INTEL_SST) += intel_sst/
obj-$(CONFIG_SPEAKUP) += speakup/
obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217) += cptm1217/
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/
obj-$(CONFIG_DRM_PSB) += gma500/
12 changes: 12 additions & 0 deletions trunk/drivers/staging/gma500/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
config DRM_PSB
tristate "Intel GMA500 KMS Framebuffer"
depends on DRM && PCI
select FB_CFB_COPYAREA
select FB_CFB_FILLRECT
select FB_CFB_IMAGEBLIT
select DRM_KMS_HELPER
select DRM_TTM
help
Say yes for an experimental KMS framebuffer driver for the
Intel GMA500 ('Poulsbo') graphics support.

30 changes: 30 additions & 0 deletions trunk/drivers/staging/gma500/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# KMS driver for the GMA500
#
ccflags-y += -Iinclude/drm

psb_gfx-y += psb_bl.o \
psb_drv.o \
psb_fb.o \
psb_gtt.o \
psb_intel_bios.o \
psb_intel_opregion.o \
psb_intel_display.o \
psb_intel_i2c.o \
psb_intel_lvds.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

obj-$(CONFIG_DRM_PSB) += psb_gfx.o
26 changes: 26 additions & 0 deletions trunk/drivers/staging/gma500/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- Test on more platforms
- Clean up the various chunks of unused code
- Sort out the power management side. Not important for Poulsbo but
matters for Moorestown
- Add Moorestown support (single pipe, no BIOS, no stolen memory,
some other differences)
- Sort out the bo and ttm code to support userframe buffers and DRM
interfaces rather than just faking it enough for a framebuffer
- Add 2D acceleration via console and DRM

As per kernel policy and the in the interest of the safety of various
kittens there is no support or plans to add hooks for the closed user space
stuff.


Why bother ?
- Proper display configuration
- Can be made to work on Moorestown where VESA won't
- Works on systems where the VESA BIOS is bust or the tables are broken
without hacks
- 2D acceleration

Currently tested on
+ Dell Mini 10 100x600


167 changes: 167 additions & 0 deletions trunk/drivers/staging/gma500/psb_bl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
/*
* psb backlight using HAL
*
* Copyright (c) 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.
*
* Authors: Eric Knopp
*
*/

#include <linux/backlight.h>
#include <linux/version.h>
#include "psb_drv.h"
#include "psb_intel_reg.h"
#include "psb_intel_drv.h"
#include "psb_intel_bios.h"
#include "psb_powermgmt.h"

#define MRST_BLC_MAX_PWM_REG_FREQ 0xFFFF
#define BLC_PWM_PRECISION_FACTOR 100 /* 10000000 */
#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
#define BLC_ADJUSTMENT_MAX 100

#define PSB_BLC_PWM_PRECISION_FACTOR 10
#define PSB_BLC_MAX_PWM_REG_FREQ 0xFFFE
#define PSB_BLC_MIN_PWM_REG_FREQ 0x2

#define PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR (0xFFFE)
#define PSB_BACKLIGHT_PWM_CTL_SHIFT (16)

static int psb_brightness;
static struct backlight_device *psb_backlight_device;
static u8 blc_brightnesscmd;
static u8 blc_pol;
static u8 blc_type;

int psb_set_brightness(struct backlight_device *bd)
{
struct drm_device *dev = bl_get_data(psb_backlight_device);
int level = bd->props.brightness;

DRM_DEBUG_DRIVER("backlight level set to %d\n", level);

/* Perform value bounds checking */
if (level < BRIGHTNESS_MIN_LEVEL)
level = BRIGHTNESS_MIN_LEVEL;

psb_intel_lvds_set_brightness(dev, level);
psb_brightness = level;
return 0;
}

int psb_get_brightness(struct backlight_device *bd)
{
DRM_DEBUG_DRIVER("brightness = 0x%x\n", psb_brightness);

/* return locally cached var instead of HW read (due to DPST etc.) */
return psb_brightness;
}

static const struct backlight_ops psb_ops = {
.get_brightness = psb_get_brightness,
.update_status = psb_set_brightness,
};

static int device_backlight_init(struct drm_device *dev)
{
unsigned long CoreClock;
/* 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;
}
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;

CoreClock = dev_priv->core_freq;

value = (CoreClock * MHz) / BLC_PWM_FREQ_CALC_CONSTANT;
value *= blc_pwm_precision_factor;
value /= bl_max_freq;
value /= blc_pwm_precision_factor;

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));
}
ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND);
}
return 0;
}

int psb_backlight_init(struct drm_device *dev)
{
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
int ret = 0;

struct backlight_properties props;
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = BRIGHTNESS_MAX_LEVEL;

psb_backlight_device = backlight_device_register("psb-bl", NULL,
(void *)dev, &psb_ops, &props);
if (IS_ERR(psb_backlight_device))
return PTR_ERR(psb_backlight_device);

ret = device_backlight_init(dev);
if (ret < 0)
return ret;

psb_backlight_device->props.brightness = BRIGHTNESS_MAX_LEVEL;
psb_backlight_device->props.max_brightness = BRIGHTNESS_MAX_LEVEL;
backlight_update_status(psb_backlight_device);
#endif
return 0;
}

void psb_backlight_exit(void)
{
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
psb_backlight_device->props.brightness = 0;
backlight_update_status(psb_backlight_device);
backlight_device_unregister(psb_backlight_device);
#endif
}

struct backlight_device *psb_get_backlight_device(void)
{
return psb_backlight_device;
}
Loading

0 comments on commit 84404ee

Please sign in to comment.