kernel/kernel-mfld-blackbay.git
12 years agogfx: drm: ttm: add support for non-swappable buffers
Imre Deak [Thu, 22 Dec 2011 20:48:27 +0000 (22:48 +0200)]
gfx: drm: ttm: add support for non-swappable buffers

Needed by buffers that can move in GPU address space, but are not
swappable. An example is a wrapped PVR buffer, added by an upcoming
patch.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drm: add missing header
Imre Deak [Thu, 22 Dec 2011 20:48:26 +0000 (22:48 +0200)]
gfx: drm: add missing header

Fix struct undefined error for struct drm_mode_modeinfo when drm_mode.h
is not included explicitly. Needed by an upcoming patch.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: fix uninitialized var bug on error path
Imre Deak [Thu, 22 Dec 2011 23:08:18 +0000 (01:08 +0200)]
gfx: pvr: fix uninitialized var bug on error path

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agopsb_video: implement reset function by power up/down MSVDX
Binglin Chen [Thu, 22 Dec 2011 19:41:13 +0000 (11:41 -0800)]
psb_video: implement reset function by power up/down MSVDX

When MSVDX FW uploading is done by PUNIT, just after
MSVDX power up operation, In order to reset HW, driver need to
do one power off and power on, and wait for PUNIT re-upload FW
again.
This patch will enable driver to reset HW when there is a request.

Signed-off-by: Binglin Chen <binglin.chen@intel.com>
Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Acked-by: Sean V Kelley <sean.v.kelley@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agopsb_video: remove MSVDX firmware uploading from driver for PNW D0
Binglin Chen [Thu, 22 Dec 2011 19:41:11 +0000 (11:41 -0800)]
psb_video: remove MSVDX firmware uploading from driver for PNW D0

For PNW C0 and older steppings, MSVDX(Video Decoder) firmware is
uploaded by driver. In PNW D0 silicon, MSVDX uploading is done by PUNIT
so video driver needs to remove firmware uploading functionality
and add adaption codes to work with PUNIT on firmware uploading,
verification, and MTX initialization.

Signed-off-by: Binglin Chen <binglin.chen@intel.com>
Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Acked-by: Sean V Kelley <sean.v.kelley@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agopsb_video: remove OSPM_GL3_CACHE_ISLAND when not enabled
Daniel Charles [Thu, 22 Dec 2011 19:41:10 +0000 (11:41 -0800)]
psb_video: remove OSPM_GL3_CACHE_ISLAND when not enabled

When setting the island up for OSPM_GL3_CACHE_ISLAND the code was not
protected when the config is not enabled

Signed-off-by: Daniel Charles <daniel.charles@intel.com>
Reviewed-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Sean V Kelley <sean.v.kelley@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Fix BUG_ON() triggering in drm_vblank_put()
Ville Syrjälä [Thu, 22 Dec 2011 17:06:20 +0000 (19:06 +0200)]
staging: mrst: Fix BUG_ON() triggering in drm_vblank_put()

We're calling drm_vblank_get() too late. It must be done before the
xchg() to avoid psb_flip_complete() from calling drm_vblank_put() before
drm_vblank_get(). This could trigger a a BUG_ON() in drm_vblank_get().

Earlier the pvr sync callbacks were usually executed with interrupts
disabled, which made the problem extremely unlikely to happen.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Make sync_list and sync_lock static
Ville Syrjälä [Thu, 22 Dec 2011 16:37:21 +0000 (18:37 +0200)]
staging: mrst: ossync: Make sync_list and sync_lock static

drivers/staging/mrst/pvr/services4/srvkm/env/linux/ossync.c:30:1: warning: symbol 'sync_lock' was not declared. Should it be static?
drivers/staging/mrst/pvr/services4/srvkm/env/linux/ossync.c:31:1: warning: symbol 'sync_list' was not declared. Should it be static?

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: Remove an unused variable
Ville Syrjälä [Thu, 22 Dec 2011 16:37:20 +0000 (18:37 +0200)]
staging: mrst: Remove an unused variable

drivers/staging/mrst/drv/psb_page_flip.c: In function 'psb_intel_crtc_page_flip':
drivers/staging/mrst/drv/psb_page_flip.c:193: warning: unused variable 'ret'

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: psb_gtt: Fix smatch warnings
Ville Syrjälä [Thu, 22 Dec 2011 15:19:47 +0000 (17:19 +0200)]
staging: mrst: psb_gtt: Fix smatch warnings

drivers/staging/mrst/drv/psb_gtt.c:54 psb_gtt_takedown(4) warn: variable dereferenced before check 'pg' (see line 52) (smatch)
drivers/staging/mrst/drv/psb_gtt.c:343 psb_gtt_mm_init(10) warn: variable dereferenced before check 'pg' (see line 336) (smatch)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: Silence a compiler warning
Ville Syrjälä [Thu, 22 Dec 2011 15:19:46 +0000 (17:19 +0200)]
staging: mrst: Silence a compiler warning

drivers/staging/mrst/drv/psb_page_flip.c: In function 'sync_callback':
drivers/staging/mrst/drv/psb_page_flip.c:102: warning: 'reg_offset' may be used uninitialized in this function

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Avoid double kmalloc()
Ville Syrjälä [Thu, 22 Dec 2011 15:19:45 +0000 (17:19 +0200)]
staging: mrst: ossync: Avoid double kmalloc()

Allow the user to embed the pending_sync structure inside its own
structure, and use container_of() in the callback.

This means we can now get by with one kmalloc() per flip, instead
of two.

As PVRSRVCallbackOnSync() can no longer fail, change the return
type to void.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Execute sync callbacks outside the spinlock
Ville Syrjälä [Thu, 22 Dec 2011 15:19:44 +0000 (17:19 +0200)]
staging: mrst: ossync: Execute sync callbacks outside the spinlock

No need to hold the spinlock while executing the sync callbacks.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Use spin_lock_irq() in PVRSRVCallbackOnSync()
Ville Syrjälä [Thu, 22 Dec 2011 15:19:43 +0000 (17:19 +0200)]
staging: mrst: ossync: Use spin_lock_irq() in PVRSRVCallbackOnSync()

The code already calls kmalloc(..., GFP_KERNEL), so interrupts can't be
off anyway.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Make flags parameter to PVRSRVCallbackOnSync() unsigned
Ville Syrjälä [Thu, 22 Dec 2011 15:19:42 +0000 (17:19 +0200)]
staging: mrst: ossync: Make flags parameter to PVRSRVCallbackOnSync() unsigned

It's a bitmask, so it should be unsigned.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: ossync: Rewrite sync counter comparisons
Ville Syrjälä [Thu, 22 Dec 2011 15:19:41 +0000 (17:19 +0200)]
staging: mrst: ossync: Rewrite sync counter comparisons

Make the sync counter comparisons handle wraparound. Also reorganize
the code a bit to make it more readable.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Use msleep(1) in ovl_wait()
Ville Syrjälä [Wed, 21 Dec 2011 00:01:38 +0000 (02:01 +0200)]
staging: mrst: overlay: Use msleep(1) in ovl_wait()

Having ovl_wait() react immediately to hardware state changes is not
critical, so use msleep(1) instead of cpu_relax().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Use double buffering for overlay registers and add suspend...
Ville Syrjälä [Wed, 21 Dec 2011 00:01:37 +0000 (02:01 +0200)]
staging: mrst: overlay: Use double buffering for overlay registers and add suspend/resume hooks

The existing suspend/resume code that fiddles with the OVADD registers
simply does not work. Replace it with something sensible.

Allocate two pages for the registers and ping-pong between them. This
allows update_plane() to do its thing without waiting for the previous
update to complete. The previous update, if not completed, will simply
be overwritten by a new update.

If the hardware is powered down when update_plane() is called we can
simply skip programming OVADD, and instead wait for the reusme hook
to do it next time the hardware is woken up. It's also theoretically
possible that the hardware gets woken up just after we've pointed the
driver to the new register page, in which case we can simply skip
programming OVADD in update_plane(), since we know the resume hook
already did it for us.

There is a slight concern whether the hardware fetches the register
contents from memory in an atomic fashion wrt. the OVADD register
writes. That is, if the hardware can still be fetching the registers
from the old page after OVADD is pointed to the new page, there
might be trouble. So far I did not observe any ill effects. The
hardware really lacks any kind of sensible status + atomic flip
registers, so if it turns out there are problems we may need to
poll the pipe scanline counter to avoid updating OVADD too close
to the time when the hardware fetches the registers from memory.
But so far that doesn't seem necessary.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Flush posted writes to the OVADD registers
Ville Syrjälä [Wed, 21 Dec 2011 00:01:36 +0000 (02:01 +0200)]
staging: mrst: overlay: Flush posted writes to the OVADD registers

We generally want the overlay update to happen without much delay, so
read the register back to make sure posted writes are flushed.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Use jiffies based timeout in ovl_wait()
Ville Syrjälä [Wed, 21 Dec 2011 00:01:35 +0000 (02:01 +0200)]
staging: mrst: overlay: Use jiffies based timeout in ovl_wait()

Wait at most 100 ms for overlay updates.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: overlay: Use set_memory_wc() instead of vmap()
Ville Syrjälä [Wed, 21 Dec 2011 00:01:34 +0000 (02:01 +0200)]
staging: mrst: overlay: Use set_memory_wc() instead of vmap()

x86 has set_memory_*() API so no need to vmap(). Also change from UC
to WC to make register updates, coeff tables in particular, more
efficient. There's a wmb() already in the code, and AFAICS that
should be enough to flush the WC buffers.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: psb_gtt: Remove the rw semaphore
Ville Syrjälä [Wed, 21 Dec 2011 00:01:33 +0000 (02:01 +0200)]
staging: mrst: psb_gtt: Remove the rw semaphore

The read/write semaphore is only taken in read mode, so it
doesn't actually do anything meaningful. Remove it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: Remove dead code
Ville Syrjälä [Wed, 21 Dec 2011 00:01:32 +0000 (02:01 +0200)]
staging: mrst: Remove dead code

Nuke a big chunk if #if 0'ed code.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agostaging: mrst: Fix error handling in psbfb_create
Ville Syrjälä [Wed, 21 Dec 2011 00:01:31 +0000 (02:01 +0200)]
staging: mrst: Fix error handling in psbfb_create

The two goto labels for unwinding on error were inverted. Swap them
around.

Fixes a smatch error:
drivers/staging/mrst/drv/psb_fb.c:421 psbfb_create(82) error: we previously assumed 'fb' could be null (see line 368) (smatch)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agodrm: Fix __user sparse warnings
Ville Syrjälä [Wed, 21 Dec 2011 00:01:30 +0000 (02:01 +0200)]
drm: Fix __user sparse warnings

Several pointers and casts were missing __user annotations.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
12 years agodrm: plane: mutex_unlock() was missing
Ville Syrjälä [Fri, 16 Dec 2011 13:35:02 +0000 (15:35 +0200)]
drm: plane: mutex_unlock() was missing

Unlock the mode_config mutex if drm_plane_init() fails.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Install drm_fourcc.h
Ville Syrjälä [Wed, 14 Dec 2011 22:12:11 +0000 (00:12 +0200)]
drm: Install drm_fourcc.h

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Fix zorder handling while overlay updates are pending
Ville Syrjälä [Wed, 14 Dec 2011 22:12:10 +0000 (00:12 +0200)]
staging: mrst: Fix zorder handling while overlay updates are pending

Configuring the Z order may potentially need to touch both overlays
simultaneosly. So ovl_wait() needs to be performed for both overlays.
Do that before touching any state to allow set_plane_opts() to fail
in a clean fashion.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Need to wait for overlay in set_plane_opts()
Ville Syrjälä [Wed, 14 Dec 2011 22:12:09 +0000 (00:12 +0200)]
staging: mrst: Need to wait for overlay in set_plane_opts()

Touching the overlay register memory while the overlay is fetching (or
primed to) the data. Do an ovl_wait() to make sure no updates are
pending.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add overlay Z order support
Ville Syrjälä [Wed, 14 Dec 2011 22:12:08 +0000 (00:12 +0200)]
staging: mrst: Add overlay Z order support

Allow the Z order of the overlay to be selected.

Note that there is something strange going on though. It seems changing
the Z order also affects destination color keying. When Z order is
configured one way destination color keying works, but when the Z order
is flipped destination color keying no longer is effective.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add overlay color keying and constant alpha
Ville Syrjälä [Wed, 14 Dec 2011 22:12:07 +0000 (00:12 +0200)]
staging: mrst: Add overlay color keying and constant alpha

Both source and destination color keying can be enabled for the
overlays.

Also the overlay constant alpha blending factor can be changed.
Note that the overlay constant alpha isn't all that useful, though.
What you usually want is to control graphics alpha. That will need
to be handled through the CRTC somehow (a new ioctl possibly) until
such time when the scanout functionality can be ripped out of the
CRTC object. When that happens the graphics plane would be just another
drm plane.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add overlay CSC matrix and chroma siting settings
Ville Syrjälä [Wed, 14 Dec 2011 22:12:06 +0000 (00:12 +0200)]
staging: mrst: Add overlay CSC matrix and chroma siting settings

The used color space conversion matrix can be toggled between BT.601 and
BT.709 versions. Also the siting of chroma samples can now be selected.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add overlay color correction settings
Ville Syrjälä [Wed, 14 Dec 2011 22:12:05 +0000 (00:12 +0200)]
staging: mrst: Add overlay color correction settings

Allow the overlay brightness, contrast, hue and saturation to be
adjusted. Also allows one to select the input range (JPEG vs. MPEG)
for the color space conversion.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add support for Medfield video overlays
Ville Syrjälä [Wed, 14 Dec 2011 22:12:04 +0000 (00:12 +0200)]
staging: mrst: Add support for Medfield video overlays

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Use drm_framebuffer_check()
Ville Syrjälä [Wed, 14 Dec 2011 22:12:03 +0000 (00:12 +0200)]
staging: mrst: Use drm_framebuffer_check()

Call drm_framebuffer_check() to verify that the requested fb layout is
sane.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Add alignment argument to psb_gtt_map_pvr_memory()
Ville Syrjälä [Wed, 14 Dec 2011 22:12:02 +0000 (00:12 +0200)]
staging: mrst: Add alignment argument to psb_gtt_map_pvr_memory()

The video overlay register block must be aligned on a 64K boundary.
Allow the caller of psb_gtt_map_pvr_memory() to specify the desired
alignment.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add drm_chroma_phase_offsets() utility function
Ville Syrjälä [Wed, 14 Dec 2011 22:12:01 +0000 (00:12 +0200)]
drm: Add drm_chroma_phase_offsets() utility function

This function is is there to help driver writers.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: plane: Add plane options ioctl
Ville Syrjälä [Wed, 14 Dec 2011 22:12:00 +0000 (00:12 +0200)]
drm: plane: Add plane options ioctl

Add a new ioctl DRM_IOCTL_MODE_PLANE_OPTS which is used to configure
various settings for the plane.

I left out gamma correction thinking that it could be added using a
separate ioctl, since there's already a gamma ioctl for CRTCs.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add drm_calc_{hscale, vscale}() utility functions
Ville Syrjälä [Wed, 14 Dec 2011 22:11:59 +0000 (00:11 +0200)]
drm: Add drm_calc_{hscale, vscale}() utility functions

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add struct drm_region and assorted utility functions
Ville Syrjälä [Wed, 14 Dec 2011 22:11:58 +0000 (00:11 +0200)]
drm: Add struct drm_region and assorted utility functions

struct drm_region represents a two dimensional region. The utility
functions are there to help driver writers.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add drm_framebuffer_check() utility function
Ville Syrjälä [Wed, 14 Dec 2011 22:11:57 +0000 (00:11 +0200)]
drm: Add drm_framebuffer_check() utility function

This function performs a battery of sanity checks on the requested
framebuffer layout. Drivers can call it from their fb_create hook.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add drm_format_{horz, vert}_chroma_subsampling() utility functions
Ville Syrjälä [Wed, 14 Dec 2011 22:11:56 +0000 (00:11 +0200)]
drm: Add drm_format_{horz, vert}_chroma_subsampling() utility functions

These functions return the chroma subsampling factors for the specified
pixel format.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add drm_format_plane_cpp() utility function
Ville Syrjälä [Wed, 14 Dec 2011 22:11:55 +0000 (00:11 +0200)]
drm: Add drm_format_plane_cpp() utility function

This function returns the bytes per pixel value based on the pixel
format and plane index.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add drm_format_num_planes() utility function
Ville Syrjälä [Wed, 14 Dec 2011 22:11:54 +0000 (00:11 +0200)]
drm: Add drm_format_num_planes() utility function

This function returns the number of planes used by a specific pixel
format.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Check that the requested pixel format is valid
Ville Syrjälä [Wed, 14 Dec 2011 22:11:53 +0000 (00:11 +0200)]
drm: Check that the requested pixel format is valid

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Handle duplicate FOURCCs
Ville Syrjälä [Wed, 14 Dec 2011 22:11:52 +0000 (00:11 +0200)]
drm: Handle duplicate FOURCCs

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Replace pitch with pitches[] in drm_framebuffer
Ville Syrjälä [Wed, 14 Dec 2011 22:11:51 +0000 (00:11 +0200)]
drm: Replace pitch with pitches[] in drm_framebuffer

Otherwise each driver would need to keep the information inside
their own framebuffer object structure. Also add offsets[]. BOs
on the other hand are driver specific, so those can be kept in
driver specific structures.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: plane: Check that the fb pixel format is supported by the plane
Ville Syrjälä [Wed, 14 Dec 2011 22:11:50 +0000 (00:11 +0200)]
drm: plane: Check that the fb pixel format is supported by the plane

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: plane: Make 'formats' parameter to drm_plane_init() const
Ville Syrjälä [Wed, 14 Dec 2011 22:11:49 +0000 (00:11 +0200)]
drm: plane: Make 'formats' parameter to drm_plane_init() const

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: plane: Check crtc coordinates against integer overflows in setplane ioctl
Ville Syrjälä [Wed, 14 Dec 2011 22:11:48 +0000 (00:11 +0200)]
drm: plane: Check crtc coordinates against integer overflows in setplane ioctl

Help drivers a little by guaranteeing that crtc_x+crtc_w and
crtc_y+crtc_h don't overflow.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: plane: Check source coordinates
Ville Syrjälä [Wed, 14 Dec 2011 22:11:47 +0000 (00:11 +0200)]
drm: plane: Check source coordinates

Make sure the source coordinates stay within the buffer.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: fourcc: Use __u32 instead of u32
Ville Syrjälä [Wed, 14 Dec 2011 22:11:46 +0000 (00:11 +0200)]
drm: fourcc: Use __u32 instead of u32

drm_fourcc.h can be included from user space so appropriate types.

Also fix some sparse errors while were at it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: plane: Clear plane.crtc and plane.fb after disable_plane()
Ville Syrjälä [Wed, 14 Dec 2011 22:11:45 +0000 (00:11 +0200)]
drm: plane: Clear plane.crtc and plane.fb after disable_plane()

These are the only indication to user space that the plane was disabled.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Redefine pixel formats
Ville Syrjälä [Wed, 14 Dec 2011 22:11:44 +0000 (00:11 +0200)]
drm: Redefine pixel formats

Name the formats as DRM_FORMAT_X instead of DRM_FOURCC_X. Use consistent
names, especially for the RGB formats. Component order and byte order are
now strictly specified for each format.

The RGB format naming follows a convention where the components names
and sizes are listed from left to right, matching the order within a
single pixel from most significant bit to least significant bit.

The YUV format names vary more. For the 4:2:2 packed formats and 2
plane formats use the fourcc. For the three plane formats the
name includes the subsampling information using the standard
subsampling notation.

The fourccs for for all the RGB formats and some of the YUV formats
I invented myself. The idea was that looking at just the fourcc you
get some idea what the format is about without having to decode it
using some external reference.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: Add a missing ')'
Ville Syrjälä [Wed, 14 Dec 2011 22:11:43 +0000 (00:11 +0200)]
drm: Add a missing ')'

The code happened to compile because the flag wasn't actually used yet.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: add an fb creation ioctl that takes a pixel format v5
Jesse Barnes [Wed, 14 Dec 2011 22:11:42 +0000 (00:11 +0200)]
drm: add an fb creation ioctl that takes a pixel format v5

To properly support the various plane formats supported by different
hardware, the kernel must know the pixel format of a framebuffer object.
So add a new ioctl taking a format argument corresponding to a fourcc
name from the new drm_fourcc.h header file.  Implement the fb creation
hooks in terms of the new mode_fb_cmd2 using helpers where the old
bpp/depth values are needed.

v2: create DRM specific fourcc header file for sharing with libdrm etc
v3: fix rebase failure and use DRM fourcc codes in intel_display.c and
    update commit message
v4: make fb_cmd2 handle field into an array for multi-object formats
    pull in Ville's fix for the memcpy in drm_plane_init
    apply Ville's cleanup to zero out fb_cmd2 arg in drm_mode_addfb
v5: add 'flags' field for interlaced support (from Ville)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Reviewed-by: Rob Clark <rob.clark@linaro.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agodrm: add plane support v3
Jesse Barnes [Wed, 14 Dec 2011 22:11:41 +0000 (00:11 +0200)]
drm: add plane support v3

Planes are a bit like half-CRTCs.  They have a location and fb, but
don't drive outputs directly.  Add support for handling them to the core
KMS code.

v2: fix ABI of get_plane - move format_type_ptr to the end
v3: add 'flags' field for interlaced support (from Ville)

Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Reviewed-by: Rob Clark <rob.clark@linaro.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agostaging: mrst: Return ERR_PTR() from fb_create hook
Ville Syrjälä [Wed, 14 Dec 2011 22:11:40 +0000 (00:11 +0200)]
staging: mrst: Return ERR_PTR() from fb_create hook

In case of an error, the caller expects ERR_PTR() to be
used instead of returning NULL.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: don't touch port control twice in a row
Jani Nikula [Fri, 9 Dec 2011 13:14:33 +0000 (15:14 +0200)]
gfx: display: don't touch port control twice in a row

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: use REG_BIT_WAIT for waiting bits to flip
Jani Nikula [Fri, 9 Dec 2011 13:14:32 +0000 (15:14 +0200)]
gfx: display: use REG_BIT_WAIT for waiting bits to flip

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: unconditionally enable display
Jani Nikula [Fri, 9 Dec 2011 13:14:31 +0000 (15:14 +0200)]
gfx: display: unconditionally enable display

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: fix pipe/plane enable disable
Jani Nikula [Fri, 9 Dec 2011 13:14:30 +0000 (15:14 +0200)]
gfx: display: fix pipe/plane enable disable

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: only change the device ready bit, don't touch others
Jani Nikula [Fri, 9 Dec 2011 13:14:29 +0000 (15:14 +0200)]
gfx: display: only change the device ready bit, don't touch others

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: reg and field helpers
Jani Nikula [Fri, 9 Dec 2011 13:14:28 +0000 (15:14 +0200)]
gfx: display: reg and field helpers

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: give the panel more time to wake up after power on
Jani Nikula [Fri, 9 Dec 2011 13:14:27 +0000 (15:14 +0200)]
gfx: display: give the panel more time to wake up after power on

The panel I2C writes would fail if done too soon after power on. The panel
spec is not explicit on how early I2C can be used, but 50 ms was clearly
too little.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: tc35876x: soft reset the LCD controller after configuration
Jani Nikula [Fri, 9 Dec 2011 13:14:26 +0000 (15:14 +0200)]
gfx: display: tc35876x: soft reset the LCD controller after configuration

Soft reset the bridge chip LCD controller after configuration according to
the chip bring up and programming guide.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: switch panel power off/on when blanking/unblanking
Jani Nikula [Fri, 9 Dec 2011 13:14:25 +0000 (15:14 +0200)]
gfx: display: switch panel power off/on when blanking/unblanking

Add the missing panel power off to save power when the display is blanked.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agoHACK: gfx: display: add display I2C device
Jani Nikula [Fri, 9 Dec 2011 13:14:24 +0000 (15:14 +0200)]
HACK: gfx: display: add display I2C device

The display I2C device (bus 2, addr 0x60) is not present in
firmware. Workaround by creating the device by ourselves.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: add driver for CMI LCD panel I2C
Jani Nikula [Fri, 9 Dec 2011 13:14:23 +0000 (15:14 +0200)]
gfx: display: add driver for CMI LCD panel I2C

The CMI LCD panel has an I2C interface for some configuration. Add driver
for it.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: put DSI lanes to ULPS before disabling pipe
Jani Nikula [Fri, 9 Dec 2011 13:14:22 +0000 (15:14 +0200)]
gfx: display: put DSI lanes to ULPS before disabling pipe

Apparently disabling the pipe does not succeed if DSI lanes are not put to
ULPS before that.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: add Android early suspend support
Jani Nikula [Fri, 9 Dec 2011 13:14:21 +0000 (15:14 +0200)]
gfx: display: add Android early suspend support

Use early suspend to switch display off, and late resume to switch display
on. Use runtime PM to automatically handle enabling and disabling hardware.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: drop gl3 enable kernel command line and module parameter
Jani Nikula [Mon, 5 Dec 2011 10:37:56 +0000 (12:37 +0200)]
gfx: display: drop gl3 enable kernel command line and module parameter

The support for enabling or disabling GL3 via module or command line
parameter is broken (as it only defines whether it's initialized or
not). Also, the gfx userspace depends on this being one or the other, and
it can't be switched at will. Just remove the parameter.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove module and early parameter to toggle runtime PM
Jani Nikula [Mon, 5 Dec 2011 10:37:55 +0000 (12:37 +0200)]
gfx: display: remove module and early parameter to toggle runtime PM

There's no point in having a module or early parameter to toggle the
driver's runtime PM on and off, since it can be done dynamically through
the sysfs /sys/devices/.../power/control files.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: clean up PCI suspend/resume
Jani Nikula [Mon, 5 Dec 2011 10:37:54 +0000 (12:37 +0200)]
gfx: display: clean up PCI suspend/resume

Don't mess with the PCI power states. The PCI core will take care of all
this for us. Clean up the functions accordingly.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: fix and clean runtime PM code
Jani Nikula [Mon, 5 Dec 2011 10:37:53 +0000 (12:37 +0200)]
gfx: display: fix and clean runtime PM code

Fix and clean up runtime PM code. Call pm_runtime_put_noidle() in init, and
pm_runtime_get_noresume() in deinit, according to the PCI runtime PM model
(see pci-driver.c). Wake up hardware in runtime resume.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove unused module parameter rtpm/gfxrtdelay
Jani Nikula [Mon, 5 Dec 2011 10:37:52 +0000 (12:37 +0200)]
gfx: display: remove unused module parameter rtpm/gfxrtdelay

The rtpm (internally gfxrtdelay) module parameter is not used for
anything. Remove it.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove the remains of unused procfs support
Jani Nikula [Mon, 5 Dec 2011 10:37:51 +0000 (12:37 +0200)]
gfx: display: remove the remains of unused procfs support

The gfx driver procfs has not been enabled or used for a while, and parts
of it are obsolete and bitrotten. Remove what's left of the procfs
support. In the unlikely event that the interface is ever needed in the
future, it should be implemented through sysfs anyway.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove suspicious runtime PM related code
Jani Nikula [Mon, 5 Dec 2011 10:37:50 +0000 (12:37 +0200)]
gfx: display: remove suspicious runtime PM related code

Remove suspicious runtime PM related code sprinkled here and there in the
driver. This is in preparation of eventually properly implementing runtime
PM.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: reduce the use of global variables
Jani Nikula [Mon, 5 Dec 2011 10:37:49 +0000 (12:37 +0200)]
gfx: display: reduce the use of global variables

Do not use gpDrmDevice (a pointer to the struct drm_device) where it's
possible to derive it from other information. This is a step towards
removing gpDrmDevice altogether.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: remove legacy pm interface
Kristen Carlson Accardi [Mon, 5 Dec 2011 10:37:48 +0000 (12:37 +0200)]
gfx: display: remove legacy pm interface

Drivers should not support both legacy and new pm framework.

Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: tc35876x: remove device creation hack
Jani Nikula [Mon, 5 Dec 2011 10:37:47 +0000 (12:37 +0200)]
gfx: display: tc35876x: remove device creation hack

The I2C device is now present in firmware. Remove the device creation hack.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: tc35876x: fix null pointer dereference in panel off
Jani Nikula [Mon, 5 Dec 2011 10:37:46 +0000 (12:37 +0200)]
gfx: display: tc35876x: fix null pointer dereference in panel off

Initialize platform data pointer before use.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: fix locking of the firmare trace debugfs entry
Imre Deak [Tue, 29 Nov 2011 10:21:31 +0000 (12:21 +0200)]
gfx: pvr: fix locking of the firmare trace debugfs entry

Fix regression introduced by:
3233b3a1 - gfx: pvr: debugfs: replace test_and_set_bit with spinlock+flag

Wrong spinlock was used..

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: make firmware trace output IMG compatible
Imre Deak [Tue, 29 Nov 2011 10:21:30 +0000 (12:21 +0200)]
gfx: pvr: make firmware trace output IMG compatible

Make the order of words in the firmware trace record match that of the
original IMG driver.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: reduce loglevel of 'fw state not available' msg
Imre Deak [Tue, 29 Nov 2011 10:21:28 +0000 (12:21 +0200)]
gfx: pvr: reduce loglevel of 'fw state not available' msg

This isn't an error, but an indication that user space wasn't built to
provide this information.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: display: Avoid NULL pointer deference
Pauli Nieminen [Fri, 25 Nov 2011 12:32:56 +0000 (14:32 +0200)]
gfx: display: Avoid NULL pointer deference

Framebuffer memory might be created without syncobject. Page fliping
assumed that all framebuffers have syncobject which oopses because of
NULL pointer deference.

That kind of memory can't be protected from tearing using
syncobject in kernel.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: hide false positive warnings include dir warnings
Kirill A. Shutemov [Fri, 25 Nov 2011 14:22:04 +0000 (16:22 +0200)]
gfx: hide false positive warnings include dir warnings

Currently if you try to build PVR driver using W=1 and O=... you'll get
a lot of warnings like:

cc1: warning: drivers/staging/mrst/pvr/include4: No such file or directory [enabled by default]

The root of the problem is kbuild. For every non-absolute -I path in
cflags kbuild adds one more option with $(srctree) prefix even if the
dir doesn't exists.

Let's workaround the issue with absolute paths.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tested-by: Imre Deak <imre.deak@intel.com>
12 years agogfx: build driver using top level Makefile and drop medfield/Makefile
Jani Nikula [Fri, 25 Nov 2011 11:08:14 +0000 (13:08 +0200)]
gfx: build driver using top level Makefile and drop medfield/Makefile

Simplify build by removing medfield/Makefile and building the driver using
top level Makefile. Clean up the Makefile.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Imre Deak <imre.deak@intel.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: Move ioctl number check before first use
Pauli Nieminen [Wed, 23 Nov 2011 19:06:25 +0000 (21:06 +0200)]
gfx: pvr: Move ioctl number check before first use

Driver is using user provided ioctl number before checking if it is in
valid range. That makes it possible to force kernel to read memory past
the end of ioctl information array.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Acked-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: fix regression in user debug request
Imre Deak [Mon, 21 Nov 2011 17:48:32 +0000 (19:48 +0200)]
gfx: pvr: fix regression in user debug request

Fix the regression during user debug request IOCTL introduced by:
7214f0fe418 - gfx: pvr: move core debugging functions to a separate file

Spotted-and-tested-by: Pauli Nieminen <pauli.nieminen@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: add hwrec_debugfs entries
Imre Deak [Fri, 18 Nov 2011 14:38:05 +0000 (16:38 +0200)]
gfx: pvr: add hwrec_debugfs entries

These entries provide details about an SGX HW recovery event. In general
the hwrec_xxx entry will provide a snapshot of the corresponding state
as it was at the time of the last recovery, while the xxx entry will
give the current state.

At the moment we have hwrec_event and hwrec_sgx_registers. hwrec_event
is special in that it can be used to step to the next HW recovery event.
After it's opened and read all other hwrec_* entries will provide the
state for the same event. A second open on hwrec_event will reset all
hwrec_* entries, in preparation for the next event.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: debugfs: replace test_and_set_bit with spinlock+flag
Imre Deak [Fri, 18 Nov 2011 14:38:04 +0000 (16:38 +0200)]
gfx: pvr: debugfs: replace test_and_set_bit with spinlock+flag

The busy variable is not really a bitmap, using a spinlock with a busy
flag better expresses the purpose.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: add sgx_save_registers_no_pwron
Imre Deak [Fri, 18 Nov 2011 14:38:03 +0000 (16:38 +0200)]
gfx: pvr: add sgx_save_registers_no_pwron

Needed by the upcoming patch.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: add sgx_{read/write}_reg
Imre Deak [Fri, 18 Nov 2011 14:38:02 +0000 (16:38 +0200)]
gfx: pvr: add sgx_{read/write}_reg

Needed by the upcoming patch.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: make sure power is on during SGX reset
Imre Deak [Fri, 18 Nov 2011 14:38:01 +0000 (16:38 +0200)]
gfx: pvr: make sure power is on during SGX reset

There is a race where after calling the SGX power-on function, it's possible
that the device will be powered-off through another IOCTL or and SGX
interrupt, before we get to perform the actual reset operation. To prevent
this, keep the power-lock for the duration of the reset.

Note that the current PVR API for powering on/off the devices is suboptimal.
Powering on a device requires acquiring the 'power lock', which will be
re-tried for a given amount of time, after which the driver will give up.
Instead of this we should have a refcount based solution and get rid of
the above timeout mechanism.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: move core debugging functions to a separate file
Imre Deak [Fri, 18 Nov 2011 14:38:00 +0000 (16:38 +0200)]
gfx: pvr: move core debugging functions to a separate file

We'll add more of similar functionality in the future, so having a
separate file for them makes things cleaner.

No functional change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: Fix mode after all drm clients have exited
Pauli Nieminen [Wed, 16 Nov 2011 00:29:39 +0000 (02:29 +0200)]
gfx: drv: Fix mode after all drm clients have exited

In case crtc is disabled surfaceflinger will fail to set mode
correct after surfaceflinger restart. Problem is assumbtion in HAL code
that KMS has set prober mode for internal display.

But drm disables crtc when surfaceflinger exists leaving its own memory
as framebuffer that is freed by kernel in process exit handling. After
all process have exited KMS driver should restore mode and fb to initial
state set by fbcon.

Adding the missing state restoration lets surfaceflinger initialize
correctly after restart.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: drv: tc35876x: Fix physical display size information
Pauli Nieminen [Tue, 15 Nov 2011 12:48:39 +0000 (14:48 +0200)]
gfx: drv: tc35876x: Fix physical display size information

The physical size of display is hardcoded in display driver. The
hardcoded value for lvds bridge is returned from tmd panel which is
phone size display.

Userspace reading the incorrect display size would calculate wrong dpi
for display which would results to incorrectly sized UI.

To provide correct information for lvds bridge driver needs separate
panel info function for lvds bridge.

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: add debugfs entry to read sgx firmware trace
Imre Deak [Thu, 10 Nov 2011 16:22:54 +0000 (18:22 +0200)]
gfx: pvr: add debugfs entry to read sgx firmware trace

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
12 years agogfx: pvr: add debugfs entry to reset sgx
Imre Deak [Thu, 10 Nov 2011 16:39:08 +0000 (18:39 +0200)]
gfx: pvr: add debugfs entry to reset sgx

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>