~ubuntu-branches/ubuntu/raring/linux-ti-omap4/raring-proposed

« back to all changes in this revision

Viewing changes to ubuntu/i915/intel_crt.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Ubuntu: 3.5.0-20.31
  • Date: 2012-12-06 14:14:29 UTC
  • Revision ID: package-import@ubuntu.com-20121206141429-3f6mmypbjdmnmm2t
Tags: 3.5.0-216.23
* Release Tracking Bug
  - LP: #1087216

[ Paolo Pisati ]

* rebased on Ubuntu-3.5.0-20.31

[ Ubuntu: 3.5.0-20.31 ]

* Release Tracking Bug
  - LP: #1086759
* SAUCE: i915_hsw: Include #define I915_PARAM_HAS_WAIT_TIMEOUT
  - LP: #1085245
* SAUCE: i915_hsw: Include #define DRM_I915_GEM_CONTEXT_[CREATE,DESTROY]
  - LP: #1085245
* SAUCE: i915_hsw: drm/i915: add register read IOCTL
  - LP: #1085245
* SAUCE: i915_hsw: Include #define i915_execbuffer2_[set,get]_context_id
  - LP: #1085245
* SAUCE: i915_hsw: Include #define I915_GEM_PARAM_HAS_SEMAPHORES
  - LP: #1085245
* SAUCE: i915_hsw: Include #define I915_PARAM_HAS_SECURE_BATCHES
  - LP: #1085245
* SAUCE: i915_hsw: drm/i915: call intel_enable_gtt
  - LP: #1085245
* SAUCE: i915_hsw: drm: add helper to sort panels to the head of the
  connector list
  - LP: #1085245
* SAUCE: i915_hsw: drm: extract dp link bw helpers
  - LP: #1085245
* SAUCE: i915_hsw: drm: extract drm_dp_max_lane_count helper
  - LP: #1085245
* SAUCE: i915_hsw: drm: dp helper: extract drm_dp_channel_eq_ok
  - LP: #1085245
* SAUCE: i915_hsw: drm: extract helpers to compute new training values
  from sink request
  - LP: #1085245
* SAUCE: i915_hsw: drm: dp helper: extract drm_dp_clock_recovery_ok
  - LP: #1085245
* SAUCE: i915_hsw: Include #define I915_PARAM_HAS_PRIME_VMAP_FLUSH
  - LP: #1085245
* SAUCE: i915_hsw: Provide an ubuntu/i915 driver for Haswell graphics
  - LP: #1085245
* SAUCE: i915_hsw: Revert "drm: Make the .mode_fixup() operations mode
  argument a const pointer" for ubuntu/i915 driver
  - LP: #1085245
* SAUCE: i915_hsw: Rename ubuntu/i915 driver i915_hsw
  - LP: #1085245
* SAUCE: i915_hsw: Only support Haswell with ubuntu/i915 driver
  - LP: #1085245
* SAUCE: i915_hsw: Include #define DRM_I915_GEM_WAIT
  - LP: #1085245
* SAUCE: i915_hsw: drm: extract dp link train delay functions from radeon
  - LP: #1085245
* SAUCE: i915_hsw: drm/dp: Update DPCD defines
  - LP: #1085245
* SAUCE: i915_hsw: Update intel_ips.h file location
  - LP: #1085245
* SAUCE: i915_hsw: Provide updated drm_mm.h and drm_mm.c for ubuntu/i915
  - LP: #1085245
* SAUCE: i915_hsw: drm/i915: Replace the array of pages with a
  scatterlist
  - LP: #1085245
* SAUCE: i915_hsw: drm/i915: Replace the array of pages with a
  scatterlist
  - LP: #1085245
* SAUCE: i915_hsw: drm/i915: Stop using AGP layer for GEN6+
  - LP: #1085245
* SAUCE: i915_hsw: Add i915_hsw_gpu_*() calls for ubuntu/i915
  - LP: #1085245
* i915_hsw: [Config] Enable CONFIG_DRM_I915_HSW=m
  - LP: #1085245
* SAUCE: drm/i915: fix hsw_fdi_link_train "retry" code
  - LP: #1085245
* SAUCE: drm/i915: reject modes the LPT FDI receiver can't handle
  - LP: #1085245
* SAUCE: drm/i915: add support for mPHY destination on intel_sbi_{read,
  write}
  - LP: #1085245
* SAUCE: drm/i915: add lpt_init_pch_refclk
  - LP: #1085245
* SAUCE: drm/i915: set the LPT FDI RX polarity reversal bit when needed
  - LP: #1085245
* Revert "SAUCE: SECCOMP: audit: always report seccomp violations"
  - LP: #1079469
* Revert "cgroup: Drop task_lock(parent) on cgroup_fork()"
  - LP: #1084539
* Revert "cgroup: Remove task_lock() from cgroup_post_fork()"
  - LP: #1084539
* Revert "x86/mm: Fix the size calculation of mapping tables"
  - LP: #1084539
* Revert "SUNRPC: Ensure we close the socket on EPIPE errors too..."
  - LP: #1084539
* Revert "ath9k_hw: Updated AR9003 tx gain table for 5GHz"
  - LP: #1084539
* Revert "sched: Add missing call to calc_load_exit_idle()"
  - LP: #1084539
* net: fix secpath kmemleak
  - LP: #1065434
* seccomp: forcing auditing of kill condition
  - LP: #1079469
* e1000e: add device IDs for i218
  - LP: #1081796
* bonding: Bonding driver does not consider the gso_max_size/gso_max_segs
  setting of slave devices.
  - LP: #1078184
* mm/hotplug: correctly add new zone to all other nodes' zone lists
  - LP: #1079860
  - CVE-2012-5517
* xen: enable platform-pci only in a Xen guest
  - LP: #1081054
* udf: fix retun value on error path in udf_load_logicalvol
  - LP: #1084539
* usb: gadget: at91_udc: fix dt support
  - LP: #1084539
* netfilter: nf_nat_sip: fix incorrect handling of EBUSY for RTCP
  expectation
  - LP: #1084539
* netfilter: nf_nat_sip: fix via header translation with multiple
  parameters
  - LP: #1084539
* netfilter: nf_ct_expect: fix possible access to uninitialized timer
  - LP: #1084539
* netfilter: xt_limit: have r->cost != 0 case work
  - LP: #1084539
* netfilter: nf_conntrack: fix racy timer handling with reliable events
  - LP: #1084539
* netfilter: nfnetlink_log: fix NLA_PUT macro removal bug
  - LP: #1084539
* MIPS: ath79: Fix CPU/DDR frequency calculation for SRIF PLLs
  - LP: #1084539
* jbd: Fix assertion failure in commit code due to lacking transaction
  credits
  - LP: #1084539
* nfsd4: fix nfs4 stateid leak
  - LP: #1084539
* NFSD: pass null terminated buf to kstrtouint()
  - LP: #1084539
* mfd: 88pm860x: Move _IO resources out of ioport_ioresource
  - LP: #1084539
* target: support zero allocation length in INQUIRY
  - LP: #1084539
* target: fix truncation of mode data, support zero allocation length
  - LP: #1084539
* target: fix return code in target_core_init_configfs error path
  - LP: #1084539
* powerpc/eeh: Lock module while handling EEH event
  - LP: #1084539
* SUNRPC: Ensure that the TCP socket is closed when in CLOSE_WAIT
  - LP: #1084539
* ext4: remove erroneous ext4_superblock_csum_set() in update_backups()
  - LP: #1084539
* block: remove the duplicated setting for congestion_threshold
  - LP: #1084539
* block: lift the initial queue bypass mode on blk_register_queue()
  instead of blk_init_allocated_queue()
  - LP: #1084539
* block: fix request_queue->flags initialization
  - LP: #1084539
* viafb: don't touch clock state on OLPC XO-1.5
  - LP: #1084539
* qla2xxx: Fix endianness of task management response code
  - LP: #1084539
* iscsi-target: Correctly set 0xffffffff field within ISCSI_OP_REJECT PDU
  - LP: #1084539
* drm/i915: use adjusted_mode instead of mode for checking the 6bpc force
  flag
  - LP: #1084539
* kbuild: Do not package /boot and /lib in make tar-pkg
  - LP: #1084539
* module: taint kernel when lve module is loaded
  - LP: #1084539
* mtd: nand: allow NAND_NO_SUBPAGE_WRITE to be set from driver
  - LP: #1084539
* nfsd4: don't pin clientids to pseudoflavors
  - LP: #1084539
* lockd: use rpc client's cl_nodename for id encoding
  - LP: #1084539
* pnfsblock: fix partial page buffer wirte
  - LP: #1084539
* pnfsblock: fix non-aligned DIO read
  - LP: #1084539
* pnfsblock: fix non-aligned DIO write
  - LP: #1084539
* target/file: Re-enable optional fd_buffered_io=1 operation
  - LP: #1084539
* iscsi-target: Add explicit set of cache_dynamic_acls=1 for TPG
  demo-mode
  - LP: #1084539
* iscsit: remove incorrect unlock in iscsit_build_sendtargets_resp
  - LP: #1084539
* iscsi-target: Bump defaults for nopin_timeout + nopin_response_timeout
  values
  - LP: #1084539
* drivers/dma/dmaengine.c: lower the priority of 'failed to get' dma
  channel message
  - LP: #1084539
* ath9k: use ieee80211_free_txskb
  - LP: #1084539
* ALSA: hda - Fix hang caused by race during suspend.
  - LP: #1084539
* ACPI: EC: Make the GPE storm threshold a module parameter
  - LP: #1084539
* ACPI: EC: Add a quirk for CLEVO M720T/M730T laptop
  - LP: #1084539
* mmc: sdhci-s3c: fix the wrong number of max bus clocks
  - LP: #1084539
* mac80211: use ieee80211_free_txskb to fix possible skb leaks
  - LP: #1084539
* ARM: OMAP: counter: add locking to read_persistent_clock
  - LP: #1084539
* ARM: vfp: fix saving d16-d31 vfp registers on v6+ kernels
  - LP: #1084539
* scsi_debug: Fix off-by-one bug when unmapping region
  - LP: #1084539
* storvsc: Account for in-transit packets in the RESET path
  - LP: #1084539
* firewire: cdev: fix user memory corruption (i386 userland on amd64
  kernel)
  - LP: #1084539
* timers: Fix endless looping between cascade() and internal_add_timer()
  - LP: #1084539
* timekeeping: Cast raw_interval to u64 to avoid shift overflow
  - LP: #1084539
* video/udlfb: fix line counting in fb_write
  - LP: #1084539
* tmpfs,ceph,gfs2,isofs,reiserfs,xfs: fix fh_len checking
  - LP: #1084539
* ALSA: hda - Add missing hda_gen_spec to struct via_spec
  - LP: #1084539
* ALSA: hda - Fix memory leaks at error path in patch_cirrus.c
  - LP: #1084539
* autofs4 - fix reset pending flag on mount fail
  - LP: #1084539
* pktgen: fix crash when generating IPv6 packets
  - LP: #1084539
* md/raid10: use correct limit variable
  - LP: #1084539
* mips,kgdb: fix recursive page fault with CONFIG_KPROBES
  - LP: #1084539
* kdb,vt_console: Fix missed data due to pager overruns
  - LP: #1084539
* xen/bootup: allow read_tscp call for Xen PV guests.
  - LP: #1084539
* xen/bootup: allow {read|write}_cr8 pvops call.
  - LP: #1084539
* libceph: eliminate connection state "DEAD"
  - LP: #1084539
* libceph: kill bad_proto ceph connection op
  - LP: #1084539
* libceph: rename socket callbacks
  - LP: #1084539
* libceph: rename kvec_reset and kvec_add functions
  - LP: #1084539
* libceph: embed ceph messenger structure in ceph_client
  - LP: #1084539
* libceph: start separating connection flags from state
  - LP: #1084539
* libceph: start tracking connection socket state
  - LP: #1084539
* libceph: provide osd number when creating osd
  - LP: #1084539
* libceph: set CLOSED state bit in con_init
  - LP: #1084539
* libceph: embed ceph connection structure in mon_client
  - LP: #1084539
* libceph: drop connection refcounting for mon_client
  - LP: #1084539
* libceph: init monitor connection when opening
  - LP: #1084539
* libceph: fully initialize connection in con_init()
  - LP: #1084539
* libceph: tweak ceph_alloc_msg()
  - LP: #1084539
* libceph: have messages point to their connection
  - LP: #1084539
* libceph: have messages take a connection reference
  - LP: #1084539
* libceph: make ceph_con_revoke() a msg operation
  - LP: #1084539
* libceph: make ceph_con_revoke_message() a msg op
  - LP: #1084539
* libceph: fix overflow in __decode_pool_names()
  - LP: #1084539
* libceph: fix overflow in osdmap_decode()
  - LP: #1084539
* libceph: fix overflow in osdmap_apply_incremental()
  - LP: #1084539
* libceph: transition socket state prior to actual connect
  - LP: #1084539
* libceph: fix NULL dereference in reset_connection()
  - LP: #1084539
* libceph: use con get/put methods
  - LP: #1084539
* libceph: drop ceph_con_get/put helpers and nref member
  - LP: #1084539
* libceph: encapsulate out message data setup
  - LP: #1084539
* libceph: encapsulate advancing msg page
  - LP: #1084539
* libceph: don't mark footer complete before it is
  - LP: #1084539
* libceph: move init_bio_*() functions up
  - LP: #1084539
* libceph: move init of bio_iter
  - LP: #1084539
* libceph: don't use bio_iter as a flag
  - LP: #1084539
* libceph: SOCK_CLOSED is a flag, not a state
  - LP: #1084539
* libceph: don't change socket state on sock event
  - LP: #1084539
* libceph: just set SOCK_CLOSED when state changes
  - LP: #1084539
* libceph: don't touch con state in con_close_socket()
  - LP: #1084539
* libceph: clear CONNECTING in ceph_con_close()
  - LP: #1084539
* libceph: clear NEGOTIATING when done
  - LP: #1084539
* libceph: define and use an explicit CONNECTED state
  - LP: #1084539
* libceph: separate banner and connect writes
  - LP: #1084539
* libceph: distinguish two phases of connect sequence
  - LP: #1084539
* libceph: small changes to messenger.c
  - LP: #1084539
* libceph: add some fine ASCII art
  - LP: #1084539
* libceph: set peer name on con_open, not init
  - LP: #1084539
* libceph: initialize mon_client con only once
  - LP: #1084539
* libceph: allow sock transition from CONNECTING to CLOSED
  - LP: #1084539
* libceph: initialize msgpool message types
  - LP: #1084539
* libceph: prevent the race of incoming work during teardown
  - LP: #1084539
* libceph: report socket read/write error message
  - LP: #1084539
* libceph: fix mutex coverage for ceph_con_close
  - LP: #1084539
* libceph: resubmit linger ops when pg mapping changes
  - LP: #1084539
* libceph: (re)initialize bio_iter on start of message receive
  - LP: #1084539
* libceph: protect ceph_con_open() with mutex
  - LP: #1084539
* libceph: reset connection retry on successfully negotiation
  - LP: #1084539
* libceph: fix fault locking; close socket on lossy fault
  - LP: #1084539
* libceph: move msgr clear_standby under con mutex protection
  - LP: #1084539
* libceph: move ceph_con_send() closed check under the con mutex
  - LP: #1084539
* libceph: drop gratuitous socket close calls in con_work
  - LP: #1084539
* libceph: close socket directly from ceph_con_close()
  - LP: #1084539
* libceph: drop unnecessary CLOSED check in socket state change callback
  - LP: #1084539
* libceph: replace connection state bits with states
  - LP: #1084539
* libceph: clean up con flags
  - LP: #1084539
* libceph: clear all flags on con_close
  - LP: #1084539
* libceph: fix handling of immediate socket connect failure
  - LP: #1084539
* libceph: revoke mon_client messages on session restart
  - LP: #1084539
* libceph: verify state after retaking con lock after dispatch
  - LP: #1084539
* libceph: avoid dropping con mutex before fault
  - LP: #1084539
* libceph: change ceph_con_in_msg_alloc convention to be less weird
  - LP: #1084539
* libceph: recheck con state after allocating incoming message
  - LP: #1084539
* libceph: fix crypto key null deref, memory leak
  - LP: #1084539
* libceph: delay debugfs initialization until we learn global_id
  - LP: #1084539
* libceph: avoid truncation due to racing banners
  - LP: #1084539
* libceph: only kunmap kmapped pages
  - LP: #1084539
* rbd: reset BACKOFF if unable to re-queue
  - LP: #1084539
* libceph: avoid NULL kref_put when osd reset races with alloc_msg
  - LP: #1084539
* ceph: fix dentry reference leak in encode_fh()
  - LP: #1084539
* ceph: Fix oops when handling mdsmap that decreases max_mds
  - LP: #1084539
* libceph: check for invalid mapping
  - LP: #1084539
* ceph: avoid 32-bit page index overflow
  - LP: #1084539
* ASoC: wm2200: Use rev A register patches on rev B
  - LP: #1084539
* ASoC: wm2200: Fix non-inverted OUT2 mute control
  - LP: #1084539
* drm/i915: remove useless BUG_ON which caused a regression in 3.5.
  - LP: #1084539
* USB: Enable LPM after a failed probe.
  - LP: #1084539
* usb: Don't enable LPM if the exit latency is zero.
  - LP: #1084539
* usb: Send Set SEL before enabling parent U1/U2 timeout.
  - LP: #1084539
* ASoC: fsi: don't reschedule DMA from an atomic context
  - LP: #1084539
* drm/i915: Set guardband clipping workaround bit in the right register.
  - LP: #1084539
* pcmcia: sharpsl: don't discard sharpsl_pcmcia_ops
  - LP: #1084539
* hwmon: (coretemp) Add support for Atom CE4110/4150/4170
  - LP: #1084539
* ALSA: hda - Fix registration race of VGA switcheroo
  - LP: #1084539
* usb: dwc3: gadget: fix 'endpoint always busy' bug
  - LP: #1084539
* usb: musb: am35xx: drop spurious unplugging a device
  - LP: #1084539
* drm/radeon: Don't destroy I2C Bus Rec in radeon_ext_tmds_enc_destroy().
  - LP: #1084539
* ALSA: hda - Always check array bounds in alc_get_line_out_pfx
  - LP: #1084539
* NLM: nlm_lookup_file() may return NLMv4-specific error codes
  - LP: #1084539
* x86: Exclude E820_RESERVED regions and memory holes above 4 GB from
  direct mapping.
  - LP: #1084539
* SUNRPC: Prevent kernel stack corruption on long values of flush
  - LP: #1084539
* USB: cdc-acm: fix pipe type of write endpoint
  - LP: #1084539
* usb: acm: fix the computation of the number of data bits
  - LP: #1084539
* usb: host: xhci: New system added for Compliance Mode Patch on
  SN65LVPE502CP
  - LP: #1084539
* USB: option: blacklist net interface on ZTE devices
  - LP: #1084539
* USB: option: add more ZTE devices
  - LP: #1084539
* ext4: race-condition protection for
  ext4_convert_unwritten_extents_endio
  - LP: #1084539
* ext4: fix metadata checksum calculation for the superblock
  - LP: #1084539
* nohz: Fix idle ticks in cpu summary line of /proc/stat
  - LP: #1084539
* ring-buffer: Check for uninitialized cpu buffer before resizing
  - LP: #1084539
* Bluetooth: SMP: Fix setting unknown auth_req bits
  - LP: #1084539
* oprofile, x86: Fix wrapping bug in op_x86_get_ctrl()
  - LP: #1084539
* cfg80211/mac80211: avoid state mishmash on deauth
  - LP: #1084539
* mac80211: check if key has TKIP type before updating IV
  - LP: #1084539
* mac80211: use ieee80211_free_txskb in a few more places
  - LP: #1084539
* bcma: fix unregistration of cores
  - LP: #1084539
* net/wireless: ipw2200: Fix panic occurring in
  ipw_handle_promiscuous_tx()
  - LP: #1084539
* iwlwifi: fix 6000 series channel switch command
  - LP: #1084539
* cgroup: notify_on_release may not be triggered in some cases
  - LP: #1084539
* dt: Document: correct tegra20/30 pinctrl slew-rate name
  - LP: #1084539
* pinctrl: tegra: set low power mode bank width to 2
  - LP: #1084539
* pinctrl: tegra: correct bank for pingroup and drv pingroup
  - LP: #1084539
* s390: fix linker script for 31 bit builds
  - LP: #1084539
* pinctrl: remove mutex lock in groups show
  - LP: #1084539
* xen/x86: don't corrupt %eip when returning from a signal handler
  - LP: #1084539
* ALSA: hda - Fix silent headphone output from Toshiba P200
  - LP: #1084539
* ext4: Checksum the block bitmap properly with bigalloc enabled
  - LP: #1084539
* ARM: 7559/1: smp: switch away from the idmap before updating
  init_mm.mm_count
  - LP: #1084539
* usb hub: send clear_tt_buffer_complete events when canceling TT clear
  work
  - LP: #1084539
* staging: comedi: amplc_pc236: fix invalid register access during detach
  - LP: #1084539
* Staging: android: binder: Fix memory leak on thread/process exit
  - LP: #1084539
* Staging: android: binder: Allow using highmem for binder buffers
  - LP: #1084539
* ext4: Avoid underflow in ext4_trim_fs()
  - LP: #1084539
* cpufreq / powernow-k8: Remove usage of smp_processor_id() in
  preemptible code
  - LP: #1084539
* extcon: Unregister compat class at module unload to fix oops
  - LP: #1084539
* extcon: unregister compat link on cleanup
  - LP: #1084539
* pinctrl: fix missing unlock on error in pinctrl_groups_show()
  - LP: #1084539
* arch/tile: avoid generating .eh_frame information in modules
  - LP: #1084539
* drm/radeon: add some new SI PCI ids
  - LP: #1084539
* drm/radeon: add error output if VM CS fails on cayman
  - LP: #1084539
* xhci: endianness xhci_calculate_intel_u2_timeout
  - LP: #1084539
* xhci: fix integer overflow
  - LP: #1084539
* dmaengine: imx-dma: fix missing unlock on error in imxdma_xfer_desc()
  - LP: #1084539
* x86-64: Fix page table accounting
  - LP: #1084539
* dmaengine: sirf: fix a typo in dma_prep_interleaved
  - LP: #1084539
* dmaengine: sirf: fix a typo in moving running dma_desc to active queue
  - LP: #1084539
* amd64_edac:__amd64_set_scrub_rate(): avoid overindexing scrubrates[]
  - LP: #1084539
* SUNRPC: Clear the connect flag when socket state is TCP_CLOSE_WAIT
  - LP: #1084539
* SUNRPC: Prevent races in xs_abort_connection()
  - LP: #1084539
* SUNRPC: Get rid of the xs_error_report socket callback
  - LP: #1084539
* iommu/tegra: smmu: Fix deadly typo
  - LP: #1084539
* ARM: at91/tc: fix typo in the DT document
  - LP: #1084539
* ARM: at91: at91sam9g10: fix SOC type detection
  - LP: #1084539
* ARM: at91/i2c: change id to let i2c-gpio work
  - LP: #1084539
* b43: Fix oops on unload when firmware not found
  - LP: #1084539
* USB: serial: Fix memory leak in sierra_release()
  - LP: #1084539
* x86, mm: Trim memory in memblock to be page aligned
  - LP: #1084539
* x86, mm: Use memblock memory loop instead of e820_RAM
  - LP: #1084539
* usb-storage: add unusual_devs entry for Casio EX-N1 digital camera
  - LP: #1084539
* Drivers: hv: Cleanup error handling in vmbus_open()
  - LP: #1084539
* sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat()
  - LP: #1084539
* vhost: fix mergeable bufs on BE hosts
  - LP: #1084539
* USB: metro-usb: fix io after disconnect
  - LP: #1084539
* USB: whiteheat: fix memory leak in error path
  - LP: #1084539
* USB: quatech2: fix memory leak in error path
  - LP: #1084539
* USB: quatech2: fix io after disconnect
  - LP: #1084539
* USB: opticon: fix DMA from stack
  - LP: #1084539
* USB: opticon: fix memory leak in error path
  - LP: #1084539
* USB: mct_u232: fix broken close
  - LP: #1084539
* USB: sierra: fix memory leak in attach error path
  - LP: #1084539
* USB: sierra: fix memory leak in probe error path
  - LP: #1084539
* USB: mos7840: fix urb leak at release
  - LP: #1084539
* USB: mos7840: fix port-device leak in error path
  - LP: #1084539
* USB: mos7840: remove NULL-urb submission
  - LP: #1084539
* USB: mos7840: remove invalid disconnect handling
  - LP: #1084539
* ehci: fix Lucid nohandoff pci quirk to be more generic with BIOS
  versions
  - LP: #1084539
* ehci: Add yet-another Lucid nohandoff pci quirk
  - LP: #1084539
* xhci: Fix potential NULL ptr deref in command cancellation.
  - LP: #1084539
* freezer: exec should clear PF_NOFREEZE along with PF_KTHREAD
  - LP: #1084539
* mm: fix XFS oops due to dirty pages without buffers on s390
  - LP: #1084539
* genalloc: stop crashing the system when destroying a pool
  - LP: #1084539
* drivers/rtc/rtc-imxdi.c: add missing spin lock initialization
  - LP: #1084539
* gen_init_cpio: avoid stack overflow when expanding
  - LP: #1084539
* fs/compat_ioctl.c: VIDEO_SET_SPU_PALETTE missing error check
  - LP: #1084539
* qmi_wwan/cdc_ether: move Novatel 551 and E362 to qmi_wwan
  - LP: #1084539
* efi: Defer freeing boot services memory until after ACPI init
  - LP: #1084539
* x86: efi: Turn off efi_enabled after setup on mixed fw/kernel
  - LP: #1082059, #1084539
* target: Re-add explict zeroing of INQUIRY bounce buffer memory
  - LP: #1084539
* ARM: 7566/1: vfp: fix save and restore when running on pre-VFPv3 and
  CONFIG_VFPv3 set
  - LP: #1084539
* libceph: drop declaration of ceph_con_get()
  - LP: #1084539
* x86, mm: Find_early_table_space based on ranges that are actually being
  mapped
  - LP: #1084539
* x86, mm: Undo incorrect revert in arch/x86/mm/init.c
  - LP: #1084539
* Linux 3.5.7.1
  - LP: #1084539
* ALSA: hda - Cirrus: Correctly clear line_out_pins when moving to
  speaker
  - LP: #1076840
* Bluetooth: ath3k: Add support for VAIO VPCEH [0489:e027]
  - LP: #898826
* i915_hsw: drm/i915: Reserve ioctl numbers for set/get_caching
  - LP: #1085245
* i915_hsw: drm: Export drm_probe_ddc()
  - LP: #1085245
* i915_hsw: drm: remove the raw_edid field from struct drm_display_info
  - LP: #1085245
* i915_hsw: drm/i915: fix hsw uncached pte
  - LP: #1085245
* i915_hsw: drm/fb-helper: delay hotplug handling when partially bound
  - LP: #1085245
* i915_hsw: drm/fb helper: don't call drm_crtc_helper_set_config
  - LP: #1085245
* i915_hsw: drm/fb-helper: don't clobber output routing in setup_crtcs
  - LP: #1085245
* i915_hsw: drm/fb helper: don't call drm_helper_connector_dpms directly
  - LP: #1085245
* i915_hsw: drm/edid: Fix potential memory leak in edid_load()
  - LP: #1085245

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2006-2007 Intel Corporation
 
3
 *
 
4
 * Permission is hereby granted, free of charge, to any person obtaining a
 
5
 * copy of this software and associated documentation files (the "Software"),
 
6
 * to deal in the Software without restriction, including without limitation
 
7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
8
 * and/or sell copies of the Software, and to permit persons to whom the
 
9
 * Software is furnished to do so, subject to the following conditions:
 
10
 *
 
11
 * The above copyright notice and this permission notice (including the next
 
12
 * paragraph) shall be included in all copies or substantial portions of the
 
13
 * Software.
 
14
 *
 
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
21
 * DEALINGS IN THE SOFTWARE.
 
22
 *
 
23
 * Authors:
 
24
 *      Eric Anholt <eric@anholt.net>
 
25
 */
 
26
 
 
27
#include <linux/dmi.h>
 
28
#include <linux/i2c.h>
 
29
#include <linux/slab.h>
 
30
#include "drmP.h"
 
31
#include "drm.h"
 
32
#include "drm_crtc.h"
 
33
#include "drm_crtc_helper.h"
 
34
#include "drm_edid.h"
 
35
#include "intel_drv.h"
 
36
#include "i915_drm.h"
 
37
#include "i915_drv.h"
 
38
 
 
39
/* Here's the desired hotplug mode */
 
40
#define ADPA_HOTPLUG_BITS (ADPA_CRT_HOTPLUG_PERIOD_128 |                \
 
41
                           ADPA_CRT_HOTPLUG_WARMUP_10MS |               \
 
42
                           ADPA_CRT_HOTPLUG_SAMPLE_4S |                 \
 
43
                           ADPA_CRT_HOTPLUG_VOLTAGE_50 |                \
 
44
                           ADPA_CRT_HOTPLUG_VOLREF_325MV |              \
 
45
                           ADPA_CRT_HOTPLUG_ENABLE)
 
46
 
 
47
struct intel_crt {
 
48
        struct intel_encoder base;
 
49
        bool force_hotplug_required;
 
50
        u32 adpa_reg;
 
51
};
 
52
 
 
53
static struct intel_crt *intel_attached_crt(struct drm_connector *connector)
 
54
{
 
55
        return container_of(intel_attached_encoder(connector),
 
56
                            struct intel_crt, base);
 
57
}
 
58
 
 
59
static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder)
 
60
{
 
61
        return container_of(encoder, struct intel_crt, base);
 
62
}
 
63
 
 
64
static bool intel_crt_get_hw_state(struct intel_encoder *encoder,
 
65
                                   enum pipe *pipe)
 
66
{
 
67
        struct drm_device *dev = encoder->base.dev;
 
68
        struct drm_i915_private *dev_priv = dev->dev_private;
 
69
        struct intel_crt *crt = intel_encoder_to_crt(encoder);
 
70
        u32 tmp;
 
71
 
 
72
        tmp = I915_READ(crt->adpa_reg);
 
73
 
 
74
        if (!(tmp & ADPA_DAC_ENABLE))
 
75
                return false;
 
76
 
 
77
        if (HAS_PCH_CPT(dev))
 
78
                *pipe = PORT_TO_PIPE_CPT(tmp);
 
79
        else
 
80
                *pipe = PORT_TO_PIPE(tmp);
 
81
 
 
82
        return true;
 
83
}
 
84
 
 
85
static void intel_disable_crt(struct intel_encoder *encoder)
 
86
{
 
87
        struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
 
88
        struct intel_crt *crt = intel_encoder_to_crt(encoder);
 
89
        u32 temp;
 
90
 
 
91
        temp = I915_READ(crt->adpa_reg);
 
92
        temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE);
 
93
        temp &= ~ADPA_DAC_ENABLE;
 
94
        I915_WRITE(crt->adpa_reg, temp);
 
95
}
 
96
 
 
97
static void intel_enable_crt(struct intel_encoder *encoder)
 
98
{
 
99
        struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
 
100
        struct intel_crt *crt = intel_encoder_to_crt(encoder);
 
101
        u32 temp;
 
102
 
 
103
        temp = I915_READ(crt->adpa_reg);
 
104
        temp |= ADPA_DAC_ENABLE;
 
105
        I915_WRITE(crt->adpa_reg, temp);
 
106
}
 
107
 
 
108
/* Note: The caller is required to filter out dpms modes not supported by the
 
109
 * platform. */
 
110
static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
 
111
{
 
112
        struct drm_device *dev = encoder->base.dev;
 
113
        struct drm_i915_private *dev_priv = dev->dev_private;
 
114
        struct intel_crt *crt = intel_encoder_to_crt(encoder);
 
115
        u32 temp;
 
116
 
 
117
        temp = I915_READ(crt->adpa_reg);
 
118
        temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE);
 
119
        temp &= ~ADPA_DAC_ENABLE;
 
120
 
 
121
        switch (mode) {
 
122
        case DRM_MODE_DPMS_ON:
 
123
                temp |= ADPA_DAC_ENABLE;
 
124
                break;
 
125
        case DRM_MODE_DPMS_STANDBY:
 
126
                temp |= ADPA_DAC_ENABLE | ADPA_HSYNC_CNTL_DISABLE;
 
127
                break;
 
128
        case DRM_MODE_DPMS_SUSPEND:
 
129
                temp |= ADPA_DAC_ENABLE | ADPA_VSYNC_CNTL_DISABLE;
 
130
                break;
 
131
        case DRM_MODE_DPMS_OFF:
 
132
                temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
 
133
                break;
 
134
        }
 
135
 
 
136
        I915_WRITE(crt->adpa_reg, temp);
 
137
}
 
138
 
 
139
static void intel_crt_dpms(struct drm_connector *connector, int mode)
 
140
{
 
141
        struct drm_device *dev = connector->dev;
 
142
        struct intel_encoder *encoder = intel_attached_encoder(connector);
 
143
        struct drm_crtc *crtc;
 
144
        int old_dpms;
 
145
 
 
146
        /* PCH platforms and VLV only support on/off. */
 
147
        if (INTEL_INFO(dev)->gen >= 5 && mode != DRM_MODE_DPMS_ON)
 
148
                mode = DRM_MODE_DPMS_OFF;
 
149
 
 
150
        if (mode == connector->dpms)
 
151
                return;
 
152
 
 
153
        old_dpms = connector->dpms;
 
154
        connector->dpms = mode;
 
155
 
 
156
        /* Only need to change hw state when actually enabled */
 
157
        crtc = encoder->base.crtc;
 
158
        if (!crtc) {
 
159
                encoder->connectors_active = false;
 
160
                return;
 
161
        }
 
162
 
 
163
        /* We need the pipe to run for anything but OFF. */
 
164
        if (mode == DRM_MODE_DPMS_OFF)
 
165
                encoder->connectors_active = false;
 
166
        else
 
167
                encoder->connectors_active = true;
 
168
 
 
169
        if (mode < old_dpms) {
 
170
                /* From off to on, enable the pipe first. */
 
171
                intel_crtc_update_dpms(crtc);
 
172
 
 
173
                intel_crt_set_dpms(encoder, mode);
 
174
        } else {
 
175
                intel_crt_set_dpms(encoder, mode);
 
176
 
 
177
                intel_crtc_update_dpms(crtc);
 
178
        }
 
179
 
 
180
        intel_modeset_check_state(connector->dev);
 
181
}
 
182
 
 
183
static int intel_crt_mode_valid(struct drm_connector *connector,
 
184
                                struct drm_display_mode *mode)
 
185
{
 
186
        struct drm_device *dev = connector->dev;
 
187
 
 
188
        int max_clock = 0;
 
189
        if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
 
190
                return MODE_NO_DBLESCAN;
 
191
 
 
192
        if (mode->clock < 25000)
 
193
                return MODE_CLOCK_LOW;
 
194
 
 
195
        if (IS_GEN2(dev))
 
196
                max_clock = 350000;
 
197
        else
 
198
                max_clock = 400000;
 
199
        if (mode->clock > max_clock)
 
200
                return MODE_CLOCK_HIGH;
 
201
 
 
202
        /* The FDI receiver on LPT only supports 8bpc and only has 2 lanes. */
 
203
        if (HAS_PCH_LPT(dev) &&
 
204
            (ironlake_get_lanes_required(mode->clock, 270000, 24) > 2))
 
205
                return MODE_CLOCK_HIGH;
 
206
 
 
207
        return MODE_OK;
 
208
}
 
209
 
 
210
static bool intel_crt_mode_fixup(struct drm_encoder *encoder,
 
211
                                 struct drm_display_mode *mode,
 
212
                                 struct drm_display_mode *adjusted_mode)
 
213
{
 
214
        return true;
 
215
}
 
216
 
 
217
static void intel_crt_mode_set(struct drm_encoder *encoder,
 
218
                               struct drm_display_mode *mode,
 
219
                               struct drm_display_mode *adjusted_mode)
 
220
{
 
221
 
 
222
        struct drm_device *dev = encoder->dev;
 
223
        struct drm_crtc *crtc = encoder->crtc;
 
224
        struct intel_crt *crt =
 
225
                intel_encoder_to_crt(to_intel_encoder(encoder));
 
226
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 
227
        struct drm_i915_private *dev_priv = dev->dev_private;
 
228
        u32 adpa;
 
229
 
 
230
        if (HAS_PCH_SPLIT(dev))
 
231
                adpa = ADPA_HOTPLUG_BITS;
 
232
        else
 
233
                adpa = 0;
 
234
 
 
235
        if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
 
236
                adpa |= ADPA_HSYNC_ACTIVE_HIGH;
 
237
        if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
 
238
                adpa |= ADPA_VSYNC_ACTIVE_HIGH;
 
239
 
 
240
        /* For CPT allow 3 pipe config, for others just use A or B */
 
241
        if (HAS_PCH_LPT(dev))
 
242
                ; /* Those bits don't exist here */
 
243
        else if (HAS_PCH_CPT(dev))
 
244
                adpa |= PORT_TRANS_SEL_CPT(intel_crtc->pipe);
 
245
        else if (intel_crtc->pipe == 0)
 
246
                adpa |= ADPA_PIPE_A_SELECT;
 
247
        else
 
248
                adpa |= ADPA_PIPE_B_SELECT;
 
249
 
 
250
        if (!HAS_PCH_SPLIT(dev))
 
251
                I915_WRITE(BCLRPAT(intel_crtc->pipe), 0);
 
252
 
 
253
        I915_WRITE(crt->adpa_reg, adpa);
 
254
}
 
255
 
 
256
static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
 
257
{
 
258
        struct drm_device *dev = connector->dev;
 
259
        struct intel_crt *crt = intel_attached_crt(connector);
 
260
        struct drm_i915_private *dev_priv = dev->dev_private;
 
261
        u32 adpa;
 
262
        bool ret;
 
263
 
 
264
        /* The first time through, trigger an explicit detection cycle */
 
265
        if (crt->force_hotplug_required) {
 
266
                bool turn_off_dac = HAS_PCH_SPLIT(dev);
 
267
                u32 save_adpa;
 
268
 
 
269
                crt->force_hotplug_required = 0;
 
270
 
 
271
                save_adpa = adpa = I915_READ(PCH_ADPA);
 
272
                DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa);
 
273
 
 
274
                adpa |= ADPA_CRT_HOTPLUG_FORCE_TRIGGER;
 
275
                if (turn_off_dac)
 
276
                        adpa &= ~ADPA_DAC_ENABLE;
 
277
 
 
278
                I915_WRITE(PCH_ADPA, adpa);
 
279
 
 
280
                if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0,
 
281
                             1000))
 
282
                        DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
 
283
 
 
284
                if (turn_off_dac) {
 
285
                        I915_WRITE(PCH_ADPA, save_adpa);
 
286
                        POSTING_READ(PCH_ADPA);
 
287
                }
 
288
        }
 
289
 
 
290
        /* Check the status to see if both blue and green are on now */
 
291
        adpa = I915_READ(PCH_ADPA);
 
292
        if ((adpa & ADPA_CRT_HOTPLUG_MONITOR_MASK) != 0)
 
293
                ret = true;
 
294
        else
 
295
                ret = false;
 
296
        DRM_DEBUG_KMS("ironlake hotplug adpa=0x%x, result %d\n", adpa, ret);
 
297
 
 
298
        return ret;
 
299
}
 
300
 
 
301
static bool valleyview_crt_detect_hotplug(struct drm_connector *connector)
 
302
{
 
303
        struct drm_device *dev = connector->dev;
 
304
        struct drm_i915_private *dev_priv = dev->dev_private;
 
305
        u32 adpa;
 
306
        bool ret;
 
307
        u32 save_adpa;
 
308
 
 
309
        save_adpa = adpa = I915_READ(ADPA);
 
310
        DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa);
 
311
 
 
312
        adpa |= ADPA_CRT_HOTPLUG_FORCE_TRIGGER;
 
313
 
 
314
        I915_WRITE(ADPA, adpa);
 
315
 
 
316
        if (wait_for((I915_READ(ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0,
 
317
                     1000)) {
 
318
                DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
 
319
                I915_WRITE(ADPA, save_adpa);
 
320
        }
 
321
 
 
322
        /* Check the status to see if both blue and green are on now */
 
323
        adpa = I915_READ(ADPA);
 
324
        if ((adpa & ADPA_CRT_HOTPLUG_MONITOR_MASK) != 0)
 
325
                ret = true;
 
326
        else
 
327
                ret = false;
 
328
 
 
329
        DRM_DEBUG_KMS("valleyview hotplug adpa=0x%x, result %d\n", adpa, ret);
 
330
 
 
331
        /* FIXME: debug force function and remove */
 
332
        ret = true;
 
333
 
 
334
        return ret;
 
335
}
 
336
 
 
337
/**
 
338
 * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect CRT presence.
 
339
 *
 
340
 * Not for i915G/i915GM
 
341
 *
 
342
 * \return true if CRT is connected.
 
343
 * \return false if CRT is disconnected.
 
344
 */
 
345
static bool intel_crt_detect_hotplug(struct drm_connector *connector)
 
346
{
 
347
        struct drm_device *dev = connector->dev;
 
348
        struct drm_i915_private *dev_priv = dev->dev_private;
 
349
        u32 hotplug_en, orig, stat;
 
350
        bool ret = false;
 
351
        int i, tries = 0;
 
352
 
 
353
        if (HAS_PCH_SPLIT(dev))
 
354
                return intel_ironlake_crt_detect_hotplug(connector);
 
355
 
 
356
        if (IS_VALLEYVIEW(dev))
 
357
                return valleyview_crt_detect_hotplug(connector);
 
358
 
 
359
        /*
 
360
         * On 4 series desktop, CRT detect sequence need to be done twice
 
361
         * to get a reliable result.
 
362
         */
 
363
 
 
364
        if (IS_G4X(dev) && !IS_GM45(dev))
 
365
                tries = 2;
 
366
        else
 
367
                tries = 1;
 
368
        hotplug_en = orig = I915_READ(PORT_HOTPLUG_EN);
 
369
        hotplug_en |= CRT_HOTPLUG_FORCE_DETECT;
 
370
 
 
371
        for (i = 0; i < tries ; i++) {
 
372
                /* turn on the FORCE_DETECT */
 
373
                I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
 
374
                /* wait for FORCE_DETECT to go off */
 
375
                if (wait_for((I915_READ(PORT_HOTPLUG_EN) &
 
376
                              CRT_HOTPLUG_FORCE_DETECT) == 0,
 
377
                             1000))
 
378
                        DRM_DEBUG_KMS("timed out waiting for FORCE_DETECT to go off");
 
379
        }
 
380
 
 
381
        stat = I915_READ(PORT_HOTPLUG_STAT);
 
382
        if ((stat & CRT_HOTPLUG_MONITOR_MASK) != CRT_HOTPLUG_MONITOR_NONE)
 
383
                ret = true;
 
384
 
 
385
        /* clear the interrupt we just generated, if any */
 
386
        I915_WRITE(PORT_HOTPLUG_STAT, CRT_HOTPLUG_INT_STATUS);
 
387
 
 
388
        /* and put the bits back */
 
389
        I915_WRITE(PORT_HOTPLUG_EN, orig);
 
390
 
 
391
        return ret;
 
392
}
 
393
 
 
394
static struct edid *intel_crt_get_edid(struct drm_connector *connector,
 
395
                                struct i2c_adapter *i2c)
 
396
{
 
397
        struct edid *edid;
 
398
 
 
399
        edid = drm_get_edid(connector, i2c);
 
400
 
 
401
        if (!edid && !intel_gmbus_is_forced_bit(i2c)) {
 
402
                DRM_DEBUG_KMS("CRT GMBUS EDID read failed, retry using GPIO bit-banging\n");
 
403
                intel_gmbus_force_bit(i2c, true);
 
404
                edid = drm_get_edid(connector, i2c);
 
405
                intel_gmbus_force_bit(i2c, false);
 
406
        }
 
407
 
 
408
        return edid;
 
409
}
 
410
 
 
411
/* local version of intel_ddc_get_modes() to use intel_crt_get_edid() */
 
412
static int intel_crt_ddc_get_modes(struct drm_connector *connector,
 
413
                                struct i2c_adapter *adapter)
 
414
{
 
415
        struct edid *edid;
 
416
        int ret;
 
417
 
 
418
        edid = intel_crt_get_edid(connector, adapter);
 
419
        if (!edid)
 
420
                return 0;
 
421
 
 
422
        ret = intel_connector_update_modes(connector, edid);
 
423
        kfree(edid);
 
424
 
 
425
        return ret;
 
426
}
 
427
 
 
428
static bool intel_crt_detect_ddc(struct drm_connector *connector)
 
429
{
 
430
        struct intel_crt *crt = intel_attached_crt(connector);
 
431
        struct drm_i915_private *dev_priv = crt->base.base.dev->dev_private;
 
432
        struct edid *edid;
 
433
        struct i2c_adapter *i2c;
 
434
 
 
435
        BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG);
 
436
 
 
437
        i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
 
438
        edid = intel_crt_get_edid(connector, i2c);
 
439
 
 
440
        if (edid) {
 
441
                bool is_digital = edid->input & DRM_EDID_INPUT_DIGITAL;
 
442
 
 
443
                /*
 
444
                 * This may be a DVI-I connector with a shared DDC
 
445
                 * link between analog and digital outputs, so we
 
446
                 * have to check the EDID input spec of the attached device.
 
447
                 */
 
448
                if (!is_digital) {
 
449
                        DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
 
450
                        return true;
 
451
                }
 
452
 
 
453
                DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a digital panel]\n");
 
454
        } else {
 
455
                DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID found]\n");
 
456
        }
 
457
 
 
458
        kfree(edid);
 
459
 
 
460
        return false;
 
461
}
 
462
 
 
463
static enum drm_connector_status
 
464
intel_crt_load_detect(struct intel_crt *crt)
 
465
{
 
466
        struct drm_device *dev = crt->base.base.dev;
 
467
        struct drm_i915_private *dev_priv = dev->dev_private;
 
468
        uint32_t pipe = to_intel_crtc(crt->base.base.crtc)->pipe;
 
469
        uint32_t save_bclrpat;
 
470
        uint32_t save_vtotal;
 
471
        uint32_t vtotal, vactive;
 
472
        uint32_t vsample;
 
473
        uint32_t vblank, vblank_start, vblank_end;
 
474
        uint32_t dsl;
 
475
        uint32_t bclrpat_reg;
 
476
        uint32_t vtotal_reg;
 
477
        uint32_t vblank_reg;
 
478
        uint32_t vsync_reg;
 
479
        uint32_t pipeconf_reg;
 
480
        uint32_t pipe_dsl_reg;
 
481
        uint8_t st00;
 
482
        enum drm_connector_status status;
 
483
 
 
484
        DRM_DEBUG_KMS("starting load-detect on CRT\n");
 
485
 
 
486
        bclrpat_reg = BCLRPAT(pipe);
 
487
        vtotal_reg = VTOTAL(pipe);
 
488
        vblank_reg = VBLANK(pipe);
 
489
        vsync_reg = VSYNC(pipe);
 
490
        pipeconf_reg = PIPECONF(pipe);
 
491
        pipe_dsl_reg = PIPEDSL(pipe);
 
492
 
 
493
        save_bclrpat = I915_READ(bclrpat_reg);
 
494
        save_vtotal = I915_READ(vtotal_reg);
 
495
        vblank = I915_READ(vblank_reg);
 
496
 
 
497
        vtotal = ((save_vtotal >> 16) & 0xfff) + 1;
 
498
        vactive = (save_vtotal & 0x7ff) + 1;
 
499
 
 
500
        vblank_start = (vblank & 0xfff) + 1;
 
501
        vblank_end = ((vblank >> 16) & 0xfff) + 1;
 
502
 
 
503
        /* Set the border color to purple. */
 
504
        I915_WRITE(bclrpat_reg, 0x500050);
 
505
 
 
506
        if (!IS_GEN2(dev)) {
 
507
                uint32_t pipeconf = I915_READ(pipeconf_reg);
 
508
                I915_WRITE(pipeconf_reg, pipeconf | PIPECONF_FORCE_BORDER);
 
509
                POSTING_READ(pipeconf_reg);
 
510
                /* Wait for next Vblank to substitue
 
511
                 * border color for Color info */
 
512
                intel_wait_for_vblank(dev, pipe);
 
513
                st00 = I915_READ8(VGA_MSR_WRITE);
 
514
                status = ((st00 & (1 << 4)) != 0) ?
 
515
                        connector_status_connected :
 
516
                        connector_status_disconnected;
 
517
 
 
518
                I915_WRITE(pipeconf_reg, pipeconf);
 
519
        } else {
 
520
                bool restore_vblank = false;
 
521
                int count, detect;
 
522
 
 
523
                /*
 
524
                * If there isn't any border, add some.
 
525
                * Yes, this will flicker
 
526
                */
 
527
                if (vblank_start <= vactive && vblank_end >= vtotal) {
 
528
                        uint32_t vsync = I915_READ(vsync_reg);
 
529
                        uint32_t vsync_start = (vsync & 0xffff) + 1;
 
530
 
 
531
                        vblank_start = vsync_start;
 
532
                        I915_WRITE(vblank_reg,
 
533
                                   (vblank_start - 1) |
 
534
                                   ((vblank_end - 1) << 16));
 
535
                        restore_vblank = true;
 
536
                }
 
537
                /* sample in the vertical border, selecting the larger one */
 
538
                if (vblank_start - vactive >= vtotal - vblank_end)
 
539
                        vsample = (vblank_start + vactive) >> 1;
 
540
                else
 
541
                        vsample = (vtotal + vblank_end) >> 1;
 
542
 
 
543
                /*
 
544
                 * Wait for the border to be displayed
 
545
                 */
 
546
                while (I915_READ(pipe_dsl_reg) >= vactive)
 
547
                        ;
 
548
                while ((dsl = I915_READ(pipe_dsl_reg)) <= vsample)
 
549
                        ;
 
550
                /*
 
551
                 * Watch ST00 for an entire scanline
 
552
                 */
 
553
                detect = 0;
 
554
                count = 0;
 
555
                do {
 
556
                        count++;
 
557
                        /* Read the ST00 VGA status register */
 
558
                        st00 = I915_READ8(VGA_MSR_WRITE);
 
559
                        if (st00 & (1 << 4))
 
560
                                detect++;
 
561
                } while ((I915_READ(pipe_dsl_reg) == dsl));
 
562
 
 
563
                /* restore vblank if necessary */
 
564
                if (restore_vblank)
 
565
                        I915_WRITE(vblank_reg, vblank);
 
566
                /*
 
567
                 * If more than 3/4 of the scanline detected a monitor,
 
568
                 * then it is assumed to be present. This works even on i830,
 
569
                 * where there isn't any way to force the border color across
 
570
                 * the screen
 
571
                 */
 
572
                status = detect * 4 > count * 3 ?
 
573
                         connector_status_connected :
 
574
                         connector_status_disconnected;
 
575
        }
 
576
 
 
577
        /* Restore previous settings */
 
578
        I915_WRITE(bclrpat_reg, save_bclrpat);
 
579
 
 
580
        return status;
 
581
}
 
582
 
 
583
static enum drm_connector_status
 
584
intel_crt_detect(struct drm_connector *connector, bool force)
 
585
{
 
586
        struct drm_device *dev = connector->dev;
 
587
        struct intel_crt *crt = intel_attached_crt(connector);
 
588
        enum drm_connector_status status;
 
589
        struct intel_load_detect_pipe tmp;
 
590
 
 
591
        if (I915_HAS_HOTPLUG(dev)) {
 
592
                /* We can not rely on the HPD pin always being correctly wired
 
593
                 * up, for example many KVM do not pass it through, and so
 
594
                 * only trust an assertion that the monitor is connected.
 
595
                 */
 
596
                if (intel_crt_detect_hotplug(connector)) {
 
597
                        DRM_DEBUG_KMS("CRT detected via hotplug\n");
 
598
                        return connector_status_connected;
 
599
                } else
 
600
                        DRM_DEBUG_KMS("CRT not detected via hotplug\n");
 
601
        }
 
602
 
 
603
        if (intel_crt_detect_ddc(connector))
 
604
                return connector_status_connected;
 
605
 
 
606
        /* Load detection is broken on HPD capable machines. Whoever wants a
 
607
         * broken monitor (without edid) to work behind a broken kvm (that fails
 
608
         * to have the right resistors for HP detection) needs to fix this up.
 
609
         * For now just bail out. */
 
610
        if (I915_HAS_HOTPLUG(dev))
 
611
                return connector_status_disconnected;
 
612
 
 
613
        if (!force)
 
614
                return connector->status;
 
615
 
 
616
        /* for pre-945g platforms use load detect */
 
617
        if (intel_get_load_detect_pipe(connector, NULL, &tmp)) {
 
618
                if (intel_crt_detect_ddc(connector))
 
619
                        status = connector_status_connected;
 
620
                else
 
621
                        status = intel_crt_load_detect(crt);
 
622
                intel_release_load_detect_pipe(connector, &tmp);
 
623
        } else
 
624
                status = connector_status_unknown;
 
625
 
 
626
        return status;
 
627
}
 
628
 
 
629
static void intel_crt_destroy(struct drm_connector *connector)
 
630
{
 
631
        drm_sysfs_connector_remove(connector);
 
632
        drm_connector_cleanup(connector);
 
633
        kfree(connector);
 
634
}
 
635
 
 
636
static int intel_crt_get_modes(struct drm_connector *connector)
 
637
{
 
638
        struct drm_device *dev = connector->dev;
 
639
        struct drm_i915_private *dev_priv = dev->dev_private;
 
640
        int ret;
 
641
        struct i2c_adapter *i2c;
 
642
 
 
643
        i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
 
644
        ret = intel_crt_ddc_get_modes(connector, i2c);
 
645
        if (ret || !IS_G4X(dev))
 
646
                return ret;
 
647
 
 
648
        /* Try to probe digital port for output in DVI-I -> VGA mode. */
 
649
        i2c = intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPB);
 
650
        return intel_crt_ddc_get_modes(connector, i2c);
 
651
}
 
652
 
 
653
static int intel_crt_set_property(struct drm_connector *connector,
 
654
                                  struct drm_property *property,
 
655
                                  uint64_t value)
 
656
{
 
657
        return 0;
 
658
}
 
659
 
 
660
static void intel_crt_reset(struct drm_connector *connector)
 
661
{
 
662
        struct drm_device *dev = connector->dev;
 
663
        struct drm_i915_private *dev_priv = dev->dev_private;
 
664
        struct intel_crt *crt = intel_attached_crt(connector);
 
665
 
 
666
        if (HAS_PCH_SPLIT(dev)) {
 
667
                u32 adpa;
 
668
 
 
669
                adpa = I915_READ(PCH_ADPA);
 
670
                adpa &= ~ADPA_CRT_HOTPLUG_MASK;
 
671
                adpa |= ADPA_HOTPLUG_BITS;
 
672
                I915_WRITE(PCH_ADPA, adpa);
 
673
                POSTING_READ(PCH_ADPA);
 
674
 
 
675
                DRM_DEBUG_KMS("pch crt adpa set to 0x%x\n", adpa);
 
676
                crt->force_hotplug_required = 1;
 
677
        }
 
678
 
 
679
}
 
680
 
 
681
/*
 
682
 * Routines for controlling stuff on the analog port
 
683
 */
 
684
 
 
685
static const struct drm_encoder_helper_funcs crt_encoder_funcs = {
 
686
        .mode_fixup = intel_crt_mode_fixup,
 
687
        .mode_set = intel_crt_mode_set,
 
688
        .disable = intel_encoder_noop,
 
689
};
 
690
 
 
691
static const struct drm_connector_funcs intel_crt_connector_funcs = {
 
692
        .reset = intel_crt_reset,
 
693
        .dpms = intel_crt_dpms,
 
694
        .detect = intel_crt_detect,
 
695
        .fill_modes = drm_helper_probe_single_connector_modes,
 
696
        .destroy = intel_crt_destroy,
 
697
        .set_property = intel_crt_set_property,
 
698
};
 
699
 
 
700
static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
 
701
        .mode_valid = intel_crt_mode_valid,
 
702
        .get_modes = intel_crt_get_modes,
 
703
        .best_encoder = intel_best_encoder,
 
704
};
 
705
 
 
706
static const struct drm_encoder_funcs intel_crt_enc_funcs = {
 
707
        .destroy = intel_encoder_destroy,
 
708
};
 
709
 
 
710
static int __init intel_no_crt_dmi_callback(const struct dmi_system_id *id)
 
711
{
 
712
        DRM_INFO("Skipping CRT initialization for %s\n", id->ident);
 
713
        return 1;
 
714
}
 
715
 
 
716
static const struct dmi_system_id intel_no_crt[] = {
 
717
        {
 
718
                .callback = intel_no_crt_dmi_callback,
 
719
                .ident = "ACER ZGB",
 
720
                .matches = {
 
721
                        DMI_MATCH(DMI_SYS_VENDOR, "ACER"),
 
722
                        DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"),
 
723
                },
 
724
        },
 
725
        { }
 
726
};
 
727
 
 
728
void intel_crt_init(struct drm_device *dev)
 
729
{
 
730
        struct drm_connector *connector;
 
731
        struct intel_crt *crt;
 
732
        struct intel_connector *intel_connector;
 
733
        struct drm_i915_private *dev_priv = dev->dev_private;
 
734
 
 
735
        /* Skip machines without VGA that falsely report hotplug events */
 
736
        if (dmi_check_system(intel_no_crt))
 
737
                return;
 
738
 
 
739
        crt = kzalloc(sizeof(struct intel_crt), GFP_KERNEL);
 
740
        if (!crt)
 
741
                return;
 
742
 
 
743
        intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
 
744
        if (!intel_connector) {
 
745
                kfree(crt);
 
746
                return;
 
747
        }
 
748
 
 
749
        connector = &intel_connector->base;
 
750
        drm_connector_init(dev, &intel_connector->base,
 
751
                           &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
 
752
 
 
753
        drm_encoder_init(dev, &crt->base.base, &intel_crt_enc_funcs,
 
754
                         DRM_MODE_ENCODER_DAC);
 
755
 
 
756
        intel_connector_attach_encoder(intel_connector, &crt->base);
 
757
 
 
758
        crt->base.type = INTEL_OUTPUT_ANALOG;
 
759
        crt->base.cloneable = true;
 
760
        if (IS_I830(dev))
 
761
                crt->base.crtc_mask = (1 << 0);
 
762
        else
 
763
                crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
 
764
 
 
765
        if (IS_GEN2(dev))
 
766
                connector->interlace_allowed = 0;
 
767
        else
 
768
                connector->interlace_allowed = 1;
 
769
        connector->doublescan_allowed = 0;
 
770
 
 
771
        if (HAS_PCH_SPLIT(dev))
 
772
                crt->adpa_reg = PCH_ADPA;
 
773
        else if (IS_VALLEYVIEW(dev))
 
774
                crt->adpa_reg = VLV_ADPA;
 
775
        else
 
776
                crt->adpa_reg = ADPA;
 
777
 
 
778
        crt->base.disable = intel_disable_crt;
 
779
        crt->base.enable = intel_enable_crt;
 
780
        if (IS_HASWELL(dev))
 
781
                crt->base.get_hw_state = intel_ddi_get_hw_state;
 
782
        else
 
783
                crt->base.get_hw_state = intel_crt_get_hw_state;
 
784
        intel_connector->get_hw_state = intel_connector_get_hw_state;
 
785
 
 
786
        drm_encoder_helper_add(&crt->base.base, &crt_encoder_funcs);
 
787
        drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
 
788
 
 
789
        drm_sysfs_connector_add(connector);
 
790
 
 
791
        if (I915_HAS_HOTPLUG(dev))
 
792
                connector->polled = DRM_CONNECTOR_POLL_HPD;
 
793
        else
 
794
                connector->polled = DRM_CONNECTOR_POLL_CONNECT;
 
795
 
 
796
        /*
 
797
         * Configure the automatic hotplug detection stuff
 
798
         */
 
799
        crt->force_hotplug_required = 0;
 
800
 
 
801
        dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS;
 
802
 
 
803
        /*
 
804
         * TODO: find a proper way to discover whether we need to set the
 
805
         * polarity reversal bit or not, instead of relying on the BIOS.
 
806
         */
 
807
        if (HAS_PCH_LPT(dev))
 
808
                dev_priv->fdi_rx_polarity_reversed =
 
809
                     !!(I915_READ(_FDI_RXA_CTL) & FDI_RX_POLARITY_REVERSED_LPT);
 
810
}