~ubuntu-branches/ubuntu/wily/linux-ti-omap4/wily

« back to all changes in this revision

Viewing changes to ubuntu/i915/intel_hdmi.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 Dave Airlie <airlied@linux.ie>
 
3
 * Copyright © 2006-2009 Intel Corporation
 
4
 *
 
5
 * Permission is hereby granted, free of charge, to any person obtaining a
 
6
 * copy of this software and associated documentation files (the "Software"),
 
7
 * to deal in the Software without restriction, including without limitation
 
8
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
9
 * and/or sell copies of the Software, and to permit persons to whom the
 
10
 * Software is furnished to do so, subject to the following conditions:
 
11
 *
 
12
 * The above copyright notice and this permission notice (including the next
 
13
 * paragraph) shall be included in all copies or substantial portions of the
 
14
 * Software.
 
15
 *
 
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
19
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
22
 * DEALINGS IN THE SOFTWARE.
 
23
 *
 
24
 * Authors:
 
25
 *      Eric Anholt <eric@anholt.net>
 
26
 *      Jesse Barnes <jesse.barnes@intel.com>
 
27
 */
 
28
 
 
29
#include <linux/i2c.h>
 
30
#include <linux/slab.h>
 
31
#include <linux/delay.h>
 
32
#include "drmP.h"
 
33
#include "drm.h"
 
34
#include "drm_crtc.h"
 
35
#include "drm_edid.h"
 
36
#include "intel_drv.h"
 
37
#include "i915_drm.h"
 
38
#include "i915_drv.h"
 
39
 
 
40
static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi)
 
41
{
 
42
        return hdmi_to_dig_port(intel_hdmi)->base.base.dev;
 
43
}
 
44
 
 
45
static void
 
46
assert_hdmi_port_disabled(struct intel_hdmi *intel_hdmi)
 
47
{
 
48
        struct drm_device *dev = intel_hdmi_to_dev(intel_hdmi);
 
49
        struct drm_i915_private *dev_priv = dev->dev_private;
 
50
        uint32_t enabled_bits;
 
51
 
 
52
        enabled_bits = IS_HASWELL(dev) ? DDI_BUF_CTL_ENABLE : SDVO_ENABLE;
 
53
 
 
54
        WARN(I915_READ(intel_hdmi->sdvox_reg) & enabled_bits,
 
55
             "HDMI port enabled, expecting disabled\n");
 
56
}
 
57
 
 
58
struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder)
 
59
{
 
60
        struct intel_digital_port *intel_dig_port =
 
61
                container_of(encoder, struct intel_digital_port, base.base);
 
62
        return &intel_dig_port->hdmi;
 
63
}
 
64
 
 
65
static struct intel_hdmi *intel_attached_hdmi(struct drm_connector *connector)
 
66
{
 
67
        return enc_to_intel_hdmi(&intel_attached_encoder(connector)->base);
 
68
}
 
69
 
 
70
void intel_dip_infoframe_csum(struct dip_infoframe *frame)
 
71
{
 
72
        uint8_t *data = (uint8_t *)frame;
 
73
        uint8_t sum = 0;
 
74
        unsigned i;
 
75
 
 
76
        frame->checksum = 0;
 
77
        frame->ecc = 0;
 
78
 
 
79
        for (i = 0; i < frame->len + DIP_HEADER_SIZE; i++)
 
80
                sum += data[i];
 
81
 
 
82
        frame->checksum = 0x100 - sum;
 
83
}
 
84
 
 
85
static u32 g4x_infoframe_index(struct dip_infoframe *frame)
 
86
{
 
87
        switch (frame->type) {
 
88
        case DIP_TYPE_AVI:
 
89
                return VIDEO_DIP_SELECT_AVI;
 
90
        case DIP_TYPE_SPD:
 
91
                return VIDEO_DIP_SELECT_SPD;
 
92
        default:
 
93
                DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
 
94
                return 0;
 
95
        }
 
96
}
 
97
 
 
98
static u32 g4x_infoframe_enable(struct dip_infoframe *frame)
 
99
{
 
100
        switch (frame->type) {
 
101
        case DIP_TYPE_AVI:
 
102
                return VIDEO_DIP_ENABLE_AVI;
 
103
        case DIP_TYPE_SPD:
 
104
                return VIDEO_DIP_ENABLE_SPD;
 
105
        default:
 
106
                DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
 
107
                return 0;
 
108
        }
 
109
}
 
110
 
 
111
static u32 hsw_infoframe_enable(struct dip_infoframe *frame)
 
112
{
 
113
        switch (frame->type) {
 
114
        case DIP_TYPE_AVI:
 
115
                return VIDEO_DIP_ENABLE_AVI_HSW;
 
116
        case DIP_TYPE_SPD:
 
117
                return VIDEO_DIP_ENABLE_SPD_HSW;
 
118
        default:
 
119
                DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
 
120
                return 0;
 
121
        }
 
122
}
 
123
 
 
124
static u32 hsw_infoframe_data_reg(struct dip_infoframe *frame, enum pipe pipe)
 
125
{
 
126
        switch (frame->type) {
 
127
        case DIP_TYPE_AVI:
 
128
                return HSW_TVIDEO_DIP_AVI_DATA(pipe);
 
129
        case DIP_TYPE_SPD:
 
130
                return HSW_TVIDEO_DIP_SPD_DATA(pipe);
 
131
        default:
 
132
                DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
 
133
                return 0;
 
134
        }
 
135
}
 
136
 
 
137
static void g4x_write_infoframe(struct drm_encoder *encoder,
 
138
                                struct dip_infoframe *frame)
 
139
{
 
140
        uint32_t *data = (uint32_t *)frame;
 
141
        struct drm_device *dev = encoder->dev;
 
142
        struct drm_i915_private *dev_priv = dev->dev_private;
 
143
        u32 val = I915_READ(VIDEO_DIP_CTL);
 
144
        unsigned i, len = DIP_HEADER_SIZE + frame->len;
 
145
 
 
146
        WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
 
147
 
 
148
        val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
 
149
        val |= g4x_infoframe_index(frame);
 
150
 
 
151
        val &= ~g4x_infoframe_enable(frame);
 
152
 
 
153
        I915_WRITE(VIDEO_DIP_CTL, val);
 
154
 
 
155
        mmiowb();
 
156
        for (i = 0; i < len; i += 4) {
 
157
                I915_WRITE(VIDEO_DIP_DATA, *data);
 
158
                data++;
 
159
        }
 
160
        /* Write every possible data byte to force correct ECC calculation. */
 
161
        for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
 
162
                I915_WRITE(VIDEO_DIP_DATA, 0);
 
163
        mmiowb();
 
164
 
 
165
        val |= g4x_infoframe_enable(frame);
 
166
        val &= ~VIDEO_DIP_FREQ_MASK;
 
167
        val |= VIDEO_DIP_FREQ_VSYNC;
 
168
 
 
169
        I915_WRITE(VIDEO_DIP_CTL, val);
 
170
        POSTING_READ(VIDEO_DIP_CTL);
 
171
}
 
172
 
 
173
static void ibx_write_infoframe(struct drm_encoder *encoder,
 
174
                                struct dip_infoframe *frame)
 
175
{
 
176
        uint32_t *data = (uint32_t *)frame;
 
177
        struct drm_device *dev = encoder->dev;
 
178
        struct drm_i915_private *dev_priv = dev->dev_private;
 
179
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 
180
        int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
 
181
        unsigned i, len = DIP_HEADER_SIZE + frame->len;
 
182
        u32 val = I915_READ(reg);
 
183
 
 
184
        WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
 
185
 
 
186
        val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
 
187
        val |= g4x_infoframe_index(frame);
 
188
 
 
189
        val &= ~g4x_infoframe_enable(frame);
 
190
 
 
191
        I915_WRITE(reg, val);
 
192
 
 
193
        mmiowb();
 
194
        for (i = 0; i < len; i += 4) {
 
195
                I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
 
196
                data++;
 
197
        }
 
198
        /* Write every possible data byte to force correct ECC calculation. */
 
199
        for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
 
200
                I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
 
201
        mmiowb();
 
202
 
 
203
        val |= g4x_infoframe_enable(frame);
 
204
        val &= ~VIDEO_DIP_FREQ_MASK;
 
205
        val |= VIDEO_DIP_FREQ_VSYNC;
 
206
 
 
207
        I915_WRITE(reg, val);
 
208
        POSTING_READ(reg);
 
209
}
 
210
 
 
211
static void cpt_write_infoframe(struct drm_encoder *encoder,
 
212
                                struct dip_infoframe *frame)
 
213
{
 
214
        uint32_t *data = (uint32_t *)frame;
 
215
        struct drm_device *dev = encoder->dev;
 
216
        struct drm_i915_private *dev_priv = dev->dev_private;
 
217
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 
218
        int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
 
219
        unsigned i, len = DIP_HEADER_SIZE + frame->len;
 
220
        u32 val = I915_READ(reg);
 
221
 
 
222
        WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
 
223
 
 
224
        val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
 
225
        val |= g4x_infoframe_index(frame);
 
226
 
 
227
        /* The DIP control register spec says that we need to update the AVI
 
228
         * infoframe without clearing its enable bit */
 
229
        if (frame->type != DIP_TYPE_AVI)
 
230
                val &= ~g4x_infoframe_enable(frame);
 
231
 
 
232
        I915_WRITE(reg, val);
 
233
 
 
234
        mmiowb();
 
235
        for (i = 0; i < len; i += 4) {
 
236
                I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
 
237
                data++;
 
238
        }
 
239
        /* Write every possible data byte to force correct ECC calculation. */
 
240
        for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
 
241
                I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
 
242
        mmiowb();
 
243
 
 
244
        val |= g4x_infoframe_enable(frame);
 
245
        val &= ~VIDEO_DIP_FREQ_MASK;
 
246
        val |= VIDEO_DIP_FREQ_VSYNC;
 
247
 
 
248
        I915_WRITE(reg, val);
 
249
        POSTING_READ(reg);
 
250
}
 
251
 
 
252
static void vlv_write_infoframe(struct drm_encoder *encoder,
 
253
                                     struct dip_infoframe *frame)
 
254
{
 
255
        uint32_t *data = (uint32_t *)frame;
 
256
        struct drm_device *dev = encoder->dev;
 
257
        struct drm_i915_private *dev_priv = dev->dev_private;
 
258
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 
259
        int reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
 
260
        unsigned i, len = DIP_HEADER_SIZE + frame->len;
 
261
        u32 val = I915_READ(reg);
 
262
 
 
263
        WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
 
264
 
 
265
        val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
 
266
        val |= g4x_infoframe_index(frame);
 
267
 
 
268
        val &= ~g4x_infoframe_enable(frame);
 
269
 
 
270
        I915_WRITE(reg, val);
 
271
 
 
272
        mmiowb();
 
273
        for (i = 0; i < len; i += 4) {
 
274
                I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
 
275
                data++;
 
276
        }
 
277
        /* Write every possible data byte to force correct ECC calculation. */
 
278
        for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
 
279
                I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
 
280
        mmiowb();
 
281
 
 
282
        val |= g4x_infoframe_enable(frame);
 
283
        val &= ~VIDEO_DIP_FREQ_MASK;
 
284
        val |= VIDEO_DIP_FREQ_VSYNC;
 
285
 
 
286
        I915_WRITE(reg, val);
 
287
        POSTING_READ(reg);
 
288
}
 
289
 
 
290
static void hsw_write_infoframe(struct drm_encoder *encoder,
 
291
                                struct dip_infoframe *frame)
 
292
{
 
293
        uint32_t *data = (uint32_t *)frame;
 
294
        struct drm_device *dev = encoder->dev;
 
295
        struct drm_i915_private *dev_priv = dev->dev_private;
 
296
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 
297
        u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->pipe);
 
298
        u32 data_reg = hsw_infoframe_data_reg(frame, intel_crtc->pipe);
 
299
        unsigned int i, len = DIP_HEADER_SIZE + frame->len;
 
300
        u32 val = I915_READ(ctl_reg);
 
301
 
 
302
        if (data_reg == 0)
 
303
                return;
 
304
 
 
305
        val &= ~hsw_infoframe_enable(frame);
 
306
        I915_WRITE(ctl_reg, val);
 
307
 
 
308
        mmiowb();
 
309
        for (i = 0; i < len; i += 4) {
 
310
                I915_WRITE(data_reg + i, *data);
 
311
                data++;
 
312
        }
 
313
        /* Write every possible data byte to force correct ECC calculation. */
 
314
        for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
 
315
                I915_WRITE(data_reg + i, 0);
 
316
        mmiowb();
 
317
 
 
318
        val |= hsw_infoframe_enable(frame);
 
319
        I915_WRITE(ctl_reg, val);
 
320
        POSTING_READ(ctl_reg);
 
321
}
 
322
 
 
323
static void intel_set_infoframe(struct drm_encoder *encoder,
 
324
                                struct dip_infoframe *frame)
 
325
{
 
326
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 
327
 
 
328
        intel_dip_infoframe_csum(frame);
 
329
        intel_hdmi->write_infoframe(encoder, frame);
 
330
}
 
331
 
 
332
static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 
333
                                         struct drm_display_mode *adjusted_mode)
 
334
{
 
335
        struct dip_infoframe avi_if = {
 
336
                .type = DIP_TYPE_AVI,
 
337
                .ver = DIP_VERSION_AVI,
 
338
                .len = DIP_LEN_AVI,
 
339
        };
 
340
 
 
341
        if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 
342
                avi_if.body.avi.YQ_CN_PR |= DIP_AVI_PR_2;
 
343
 
 
344
        intel_set_infoframe(encoder, &avi_if);
 
345
}
 
346
 
 
347
static void intel_hdmi_set_spd_infoframe(struct drm_encoder *encoder)
 
348
{
 
349
        struct dip_infoframe spd_if;
 
350
 
 
351
        memset(&spd_if, 0, sizeof(spd_if));
 
352
        spd_if.type = DIP_TYPE_SPD;
 
353
        spd_if.ver = DIP_VERSION_SPD;
 
354
        spd_if.len = DIP_LEN_SPD;
 
355
        strcpy(spd_if.body.spd.vn, "Intel");
 
356
        strcpy(spd_if.body.spd.pd, "Integrated gfx");
 
357
        spd_if.body.spd.sdi = DIP_SPD_PC;
 
358
 
 
359
        intel_set_infoframe(encoder, &spd_if);
 
360
}
 
361
 
 
362
static void g4x_set_infoframes(struct drm_encoder *encoder,
 
363
                               struct drm_display_mode *adjusted_mode)
 
364
{
 
365
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
 
366
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 
367
        u32 reg = VIDEO_DIP_CTL;
 
368
        u32 val = I915_READ(reg);
 
369
        u32 port;
 
370
 
 
371
        assert_hdmi_port_disabled(intel_hdmi);
 
372
 
 
373
        /* If the registers were not initialized yet, they might be zeroes,
 
374
         * which means we're selecting the AVI DIP and we're setting its
 
375
         * frequency to once. This seems to really confuse the HW and make
 
376
         * things stop working (the register spec says the AVI always needs to
 
377
         * be sent every VSync). So here we avoid writing to the register more
 
378
         * than we need and also explicitly select the AVI DIP and explicitly
 
379
         * set its frequency to every VSync. Avoiding to write it twice seems to
 
380
         * be enough to solve the problem, but being defensive shouldn't hurt us
 
381
         * either. */
 
382
        val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
 
383
 
 
384
        if (!intel_hdmi->has_hdmi_sink) {
 
385
                if (!(val & VIDEO_DIP_ENABLE))
 
386
                        return;
 
387
                val &= ~VIDEO_DIP_ENABLE;
 
388
                I915_WRITE(reg, val);
 
389
                POSTING_READ(reg);
 
390
                return;
 
391
        }
 
392
 
 
393
        switch (intel_hdmi->sdvox_reg) {
 
394
        case SDVOB:
 
395
                port = VIDEO_DIP_PORT_B;
 
396
                break;
 
397
        case SDVOC:
 
398
                port = VIDEO_DIP_PORT_C;
 
399
                break;
 
400
        default:
 
401
                BUG();
 
402
                return;
 
403
        }
 
404
 
 
405
        if (port != (val & VIDEO_DIP_PORT_MASK)) {
 
406
                if (val & VIDEO_DIP_ENABLE) {
 
407
                        val &= ~VIDEO_DIP_ENABLE;
 
408
                        I915_WRITE(reg, val);
 
409
                        POSTING_READ(reg);
 
410
                }
 
411
                val &= ~VIDEO_DIP_PORT_MASK;
 
412
                val |= port;
 
413
        }
 
414
 
 
415
        val |= VIDEO_DIP_ENABLE;
 
416
        val &= ~VIDEO_DIP_ENABLE_VENDOR;
 
417
 
 
418
        I915_WRITE(reg, val);
 
419
        POSTING_READ(reg);
 
420
 
 
421
        intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
 
422
        intel_hdmi_set_spd_infoframe(encoder);
 
423
}
 
424
 
 
425
static void ibx_set_infoframes(struct drm_encoder *encoder,
 
426
                               struct drm_display_mode *adjusted_mode)
 
427
{
 
428
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
 
429
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 
430
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 
431
        u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
 
432
        u32 val = I915_READ(reg);
 
433
        u32 port;
 
434
 
 
435
        assert_hdmi_port_disabled(intel_hdmi);
 
436
 
 
437
        /* See the big comment in g4x_set_infoframes() */
 
438
        val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
 
439
 
 
440
        if (!intel_hdmi->has_hdmi_sink) {
 
441
                if (!(val & VIDEO_DIP_ENABLE))
 
442
                        return;
 
443
                val &= ~VIDEO_DIP_ENABLE;
 
444
                I915_WRITE(reg, val);
 
445
                POSTING_READ(reg);
 
446
                return;
 
447
        }
 
448
 
 
449
        switch (intel_hdmi->sdvox_reg) {
 
450
        case HDMIB:
 
451
                port = VIDEO_DIP_PORT_B;
 
452
                break;
 
453
        case HDMIC:
 
454
                port = VIDEO_DIP_PORT_C;
 
455
                break;
 
456
        case HDMID:
 
457
                port = VIDEO_DIP_PORT_D;
 
458
                break;
 
459
        default:
 
460
                BUG();
 
461
                return;
 
462
        }
 
463
 
 
464
        if (port != (val & VIDEO_DIP_PORT_MASK)) {
 
465
                if (val & VIDEO_DIP_ENABLE) {
 
466
                        val &= ~VIDEO_DIP_ENABLE;
 
467
                        I915_WRITE(reg, val);
 
468
                        POSTING_READ(reg);
 
469
                }
 
470
                val &= ~VIDEO_DIP_PORT_MASK;
 
471
                val |= port;
 
472
        }
 
473
 
 
474
        val |= VIDEO_DIP_ENABLE;
 
475
        val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
 
476
                 VIDEO_DIP_ENABLE_GCP);
 
477
 
 
478
        I915_WRITE(reg, val);
 
479
        POSTING_READ(reg);
 
480
 
 
481
        intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
 
482
        intel_hdmi_set_spd_infoframe(encoder);
 
483
}
 
484
 
 
485
static void cpt_set_infoframes(struct drm_encoder *encoder,
 
486
                               struct drm_display_mode *adjusted_mode)
 
487
{
 
488
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
 
489
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 
490
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 
491
        u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
 
492
        u32 val = I915_READ(reg);
 
493
 
 
494
        assert_hdmi_port_disabled(intel_hdmi);
 
495
 
 
496
        /* See the big comment in g4x_set_infoframes() */
 
497
        val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
 
498
 
 
499
        if (!intel_hdmi->has_hdmi_sink) {
 
500
                if (!(val & VIDEO_DIP_ENABLE))
 
501
                        return;
 
502
                val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI);
 
503
                I915_WRITE(reg, val);
 
504
                POSTING_READ(reg);
 
505
                return;
 
506
        }
 
507
 
 
508
        /* Set both together, unset both together: see the spec. */
 
509
        val |= VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI;
 
510
        val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
 
511
                 VIDEO_DIP_ENABLE_GCP);
 
512
 
 
513
        I915_WRITE(reg, val);
 
514
        POSTING_READ(reg);
 
515
 
 
516
        intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
 
517
        intel_hdmi_set_spd_infoframe(encoder);
 
518
}
 
519
 
 
520
static void vlv_set_infoframes(struct drm_encoder *encoder,
 
521
                               struct drm_display_mode *adjusted_mode)
 
522
{
 
523
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
 
524
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 
525
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 
526
        u32 reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
 
527
        u32 val = I915_READ(reg);
 
528
 
 
529
        assert_hdmi_port_disabled(intel_hdmi);
 
530
 
 
531
        /* See the big comment in g4x_set_infoframes() */
 
532
        val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
 
533
 
 
534
        if (!intel_hdmi->has_hdmi_sink) {
 
535
                if (!(val & VIDEO_DIP_ENABLE))
 
536
                        return;
 
537
                val &= ~VIDEO_DIP_ENABLE;
 
538
                I915_WRITE(reg, val);
 
539
                POSTING_READ(reg);
 
540
                return;
 
541
        }
 
542
 
 
543
        val |= VIDEO_DIP_ENABLE;
 
544
        val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
 
545
                 VIDEO_DIP_ENABLE_GCP);
 
546
 
 
547
        I915_WRITE(reg, val);
 
548
        POSTING_READ(reg);
 
549
 
 
550
        intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
 
551
        intel_hdmi_set_spd_infoframe(encoder);
 
552
}
 
553
 
 
554
static void hsw_set_infoframes(struct drm_encoder *encoder,
 
555
                               struct drm_display_mode *adjusted_mode)
 
556
{
 
557
        struct drm_i915_private *dev_priv = encoder->dev->dev_private;
 
558
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 
559
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 
560
        u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->pipe);
 
561
        u32 val = I915_READ(reg);
 
562
 
 
563
        assert_hdmi_port_disabled(intel_hdmi);
 
564
 
 
565
        if (!intel_hdmi->has_hdmi_sink) {
 
566
                I915_WRITE(reg, 0);
 
567
                POSTING_READ(reg);
 
568
                return;
 
569
        }
 
570
 
 
571
        val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_GCP_HSW |
 
572
                 VIDEO_DIP_ENABLE_VS_HSW | VIDEO_DIP_ENABLE_GMP_HSW);
 
573
 
 
574
        I915_WRITE(reg, val);
 
575
        POSTING_READ(reg);
 
576
 
 
577
        intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
 
578
        intel_hdmi_set_spd_infoframe(encoder);
 
579
}
 
580
 
 
581
static void intel_hdmi_mode_set(struct drm_encoder *encoder,
 
582
                                struct drm_display_mode *mode,
 
583
                                struct drm_display_mode *adjusted_mode)
 
584
{
 
585
        struct drm_device *dev = encoder->dev;
 
586
        struct drm_i915_private *dev_priv = dev->dev_private;
 
587
        struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 
588
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
 
589
        u32 sdvox;
 
590
 
 
591
        sdvox = SDVO_ENCODING_HDMI;
 
592
        if (!HAS_PCH_SPLIT(dev))
 
593
                sdvox |= intel_hdmi->color_range;
 
594
        if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
 
595
                sdvox |= SDVO_VSYNC_ACTIVE_HIGH;
 
596
        if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
 
597
                sdvox |= SDVO_HSYNC_ACTIVE_HIGH;
 
598
 
 
599
        if (intel_crtc->bpp > 24)
 
600
                sdvox |= COLOR_FORMAT_12bpc;
 
601
        else
 
602
                sdvox |= COLOR_FORMAT_8bpc;
 
603
 
 
604
        /* Required on CPT */
 
605
        if (intel_hdmi->has_hdmi_sink && HAS_PCH_CPT(dev))
 
606
                sdvox |= HDMI_MODE_SELECT;
 
607
 
 
608
        if (intel_hdmi->has_audio) {
 
609
                DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n",
 
610
                                 pipe_name(intel_crtc->pipe));
 
611
                sdvox |= SDVO_AUDIO_ENABLE;
 
612
                sdvox |= SDVO_NULL_PACKETS_DURING_VSYNC;
 
613
                intel_write_eld(encoder, adjusted_mode);
 
614
        }
 
615
 
 
616
        if (HAS_PCH_CPT(dev))
 
617
                sdvox |= PORT_TRANS_SEL_CPT(intel_crtc->pipe);
 
618
        else if (intel_crtc->pipe == PIPE_B)
 
619
                sdvox |= SDVO_PIPE_B_SELECT;
 
620
 
 
621
        I915_WRITE(intel_hdmi->sdvox_reg, sdvox);
 
622
        POSTING_READ(intel_hdmi->sdvox_reg);
 
623
 
 
624
        intel_hdmi->set_infoframes(encoder, adjusted_mode);
 
625
}
 
626
 
 
627
static bool intel_hdmi_get_hw_state(struct intel_encoder *encoder,
 
628
                                    enum pipe *pipe)
 
629
{
 
630
        struct drm_device *dev = encoder->base.dev;
 
631
        struct drm_i915_private *dev_priv = dev->dev_private;
 
632
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
 
633
        u32 tmp;
 
634
 
 
635
        tmp = I915_READ(intel_hdmi->sdvox_reg);
 
636
 
 
637
        if (!(tmp & SDVO_ENABLE))
 
638
                return false;
 
639
 
 
640
        if (HAS_PCH_CPT(dev))
 
641
                *pipe = PORT_TO_PIPE_CPT(tmp);
 
642
        else
 
643
                *pipe = PORT_TO_PIPE(tmp);
 
644
 
 
645
        return true;
 
646
}
 
647
 
 
648
static void intel_enable_hdmi(struct intel_encoder *encoder)
 
649
{
 
650
        struct drm_device *dev = encoder->base.dev;
 
651
        struct drm_i915_private *dev_priv = dev->dev_private;
 
652
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
 
653
        u32 temp;
 
654
        u32 enable_bits = SDVO_ENABLE;
 
655
 
 
656
        if (intel_hdmi->has_audio)
 
657
                enable_bits |= SDVO_AUDIO_ENABLE;
 
658
 
 
659
        temp = I915_READ(intel_hdmi->sdvox_reg);
 
660
 
 
661
        /* HW workaround for IBX, we need to move the port to transcoder A
 
662
         * before disabling it. */
 
663
        if (HAS_PCH_IBX(dev)) {
 
664
                struct drm_crtc *crtc = encoder->base.crtc;
 
665
                int pipe = crtc ? to_intel_crtc(crtc)->pipe : -1;
 
666
 
 
667
                /* Restore the transcoder select bit. */
 
668
                if (pipe == PIPE_B)
 
669
                        enable_bits |= SDVO_PIPE_B_SELECT;
 
670
        }
 
671
 
 
672
        /* HW workaround, need to toggle enable bit off and on for 12bpc, but
 
673
         * we do this anyway which shows more stable in testing.
 
674
         */
 
675
        if (HAS_PCH_SPLIT(dev)) {
 
676
                I915_WRITE(intel_hdmi->sdvox_reg, temp & ~SDVO_ENABLE);
 
677
                POSTING_READ(intel_hdmi->sdvox_reg);
 
678
        }
 
679
 
 
680
        temp |= enable_bits;
 
681
 
 
682
        I915_WRITE(intel_hdmi->sdvox_reg, temp);
 
683
        POSTING_READ(intel_hdmi->sdvox_reg);
 
684
 
 
685
        /* HW workaround, need to write this twice for issue that may result
 
686
         * in first write getting masked.
 
687
         */
 
688
        if (HAS_PCH_SPLIT(dev)) {
 
689
                I915_WRITE(intel_hdmi->sdvox_reg, temp);
 
690
                POSTING_READ(intel_hdmi->sdvox_reg);
 
691
        }
 
692
}
 
693
 
 
694
static void intel_disable_hdmi(struct intel_encoder *encoder)
 
695
{
 
696
        struct drm_device *dev = encoder->base.dev;
 
697
        struct drm_i915_private *dev_priv = dev->dev_private;
 
698
        struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
 
699
        u32 temp;
 
700
        u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE;
 
701
 
 
702
        temp = I915_READ(intel_hdmi->sdvox_reg);
 
703
 
 
704
        /* HW workaround for IBX, we need to move the port to transcoder A
 
705
         * before disabling it. */
 
706
        if (HAS_PCH_IBX(dev)) {
 
707
                struct drm_crtc *crtc = encoder->base.crtc;
 
708
                int pipe = crtc ? to_intel_crtc(crtc)->pipe : -1;
 
709
 
 
710
                if (temp & SDVO_PIPE_B_SELECT) {
 
711
                        temp &= ~SDVO_PIPE_B_SELECT;
 
712
                        I915_WRITE(intel_hdmi->sdvox_reg, temp);
 
713
                        POSTING_READ(intel_hdmi->sdvox_reg);
 
714
 
 
715
                        /* Again we need to write this twice. */
 
716
                        I915_WRITE(intel_hdmi->sdvox_reg, temp);
 
717
                        POSTING_READ(intel_hdmi->sdvox_reg);
 
718
 
 
719
                        /* Transcoder selection bits only update
 
720
                         * effectively on vblank. */
 
721
                        if (crtc)
 
722
                                intel_wait_for_vblank(dev, pipe);
 
723
                        else
 
724
                                msleep(50);
 
725
                }
 
726
        }
 
727
 
 
728
        /* HW workaround, need to toggle enable bit off and on for 12bpc, but
 
729
         * we do this anyway which shows more stable in testing.
 
730
         */
 
731
        if (HAS_PCH_SPLIT(dev)) {
 
732
                I915_WRITE(intel_hdmi->sdvox_reg, temp & ~SDVO_ENABLE);
 
733
                POSTING_READ(intel_hdmi->sdvox_reg);
 
734
        }
 
735
 
 
736
        temp &= ~enable_bits;
 
737
 
 
738
        I915_WRITE(intel_hdmi->sdvox_reg, temp);
 
739
        POSTING_READ(intel_hdmi->sdvox_reg);
 
740
 
 
741
        /* HW workaround, need to write this twice for issue that may result
 
742
         * in first write getting masked.
 
743
         */
 
744
        if (HAS_PCH_SPLIT(dev)) {
 
745
                I915_WRITE(intel_hdmi->sdvox_reg, temp);
 
746
                POSTING_READ(intel_hdmi->sdvox_reg);
 
747
        }
 
748
}
 
749
 
 
750
static int intel_hdmi_mode_valid(struct drm_connector *connector,
 
751
                                 struct drm_display_mode *mode)
 
752
{
 
753
        if (mode->clock > 165000)
 
754
                return MODE_CLOCK_HIGH;
 
755
        if (mode->clock < 20000)
 
756
                return MODE_CLOCK_LOW;
 
757
 
 
758
        if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
 
759
                return MODE_NO_DBLESCAN;
 
760
 
 
761
        return MODE_OK;
 
762
}
 
763
 
 
764
bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
 
765
                           struct drm_display_mode *mode,
 
766
                           struct drm_display_mode *adjusted_mode)
 
767
{
 
768
        return true;
 
769
}
 
770
 
 
771
static bool g4x_hdmi_connected(struct intel_hdmi *intel_hdmi)
 
772
{
 
773
        struct drm_device *dev = intel_hdmi_to_dev(intel_hdmi);
 
774
        struct drm_i915_private *dev_priv = dev->dev_private;
 
775
        uint32_t bit;
 
776
 
 
777
        switch (intel_hdmi->sdvox_reg) {
 
778
        case SDVOB:
 
779
                bit = HDMIB_HOTPLUG_LIVE_STATUS;
 
780
                break;
 
781
        case SDVOC:
 
782
                bit = HDMIC_HOTPLUG_LIVE_STATUS;
 
783
                break;
 
784
        default:
 
785
                bit = 0;
 
786
                break;
 
787
        }
 
788
 
 
789
        return I915_READ(PORT_HOTPLUG_STAT) & bit;
 
790
}
 
791
 
 
792
static enum drm_connector_status
 
793
intel_hdmi_detect(struct drm_connector *connector, bool force)
 
794
{
 
795
        struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 
796
        struct intel_digital_port *intel_dig_port =
 
797
                hdmi_to_dig_port(intel_hdmi);
 
798
        struct intel_encoder *intel_encoder = &intel_dig_port->base;
 
799
        struct drm_i915_private *dev_priv = connector->dev->dev_private;
 
800
        struct edid *edid;
 
801
        enum drm_connector_status status = connector_status_disconnected;
 
802
 
 
803
        if (IS_G4X(connector->dev) && !g4x_hdmi_connected(intel_hdmi))
 
804
                return status;
 
805
 
 
806
        intel_hdmi->has_hdmi_sink = false;
 
807
        intel_hdmi->has_audio = false;
 
808
        edid = drm_get_edid(connector,
 
809
                            intel_gmbus_get_adapter(dev_priv,
 
810
                                                    intel_hdmi->ddc_bus));
 
811
 
 
812
        if (edid) {
 
813
                if (edid->input & DRM_EDID_INPUT_DIGITAL) {
 
814
                        status = connector_status_connected;
 
815
                        if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI)
 
816
                                intel_hdmi->has_hdmi_sink =
 
817
                                                drm_detect_hdmi_monitor(edid);
 
818
                        intel_hdmi->has_audio = drm_detect_monitor_audio(edid);
 
819
                }
 
820
                kfree(edid);
 
821
        }
 
822
 
 
823
        if (status == connector_status_connected) {
 
824
                if (intel_hdmi->force_audio != HDMI_AUDIO_AUTO)
 
825
                        intel_hdmi->has_audio =
 
826
                                (intel_hdmi->force_audio == HDMI_AUDIO_ON);
 
827
                intel_encoder->type = INTEL_OUTPUT_HDMI;
 
828
        }
 
829
 
 
830
        return status;
 
831
}
 
832
 
 
833
static int intel_hdmi_get_modes(struct drm_connector *connector)
 
834
{
 
835
        struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 
836
        struct drm_i915_private *dev_priv = connector->dev->dev_private;
 
837
 
 
838
        /* We should parse the EDID data and find out if it's an HDMI sink so
 
839
         * we can send audio to it.
 
840
         */
 
841
 
 
842
        return intel_ddc_get_modes(connector,
 
843
                                   intel_gmbus_get_adapter(dev_priv,
 
844
                                                           intel_hdmi->ddc_bus));
 
845
}
 
846
 
 
847
static bool
 
848
intel_hdmi_detect_audio(struct drm_connector *connector)
 
849
{
 
850
        struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 
851
        struct drm_i915_private *dev_priv = connector->dev->dev_private;
 
852
        struct edid *edid;
 
853
        bool has_audio = false;
 
854
 
 
855
        edid = drm_get_edid(connector,
 
856
                            intel_gmbus_get_adapter(dev_priv,
 
857
                                                    intel_hdmi->ddc_bus));
 
858
        if (edid) {
 
859
                if (edid->input & DRM_EDID_INPUT_DIGITAL)
 
860
                        has_audio = drm_detect_monitor_audio(edid);
 
861
                kfree(edid);
 
862
        }
 
863
 
 
864
        return has_audio;
 
865
}
 
866
 
 
867
static int
 
868
intel_hdmi_set_property(struct drm_connector *connector,
 
869
                        struct drm_property *property,
 
870
                        uint64_t val)
 
871
{
 
872
        struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 
873
        struct intel_digital_port *intel_dig_port =
 
874
                hdmi_to_dig_port(intel_hdmi);
 
875
        struct drm_i915_private *dev_priv = connector->dev->dev_private;
 
876
        int ret;
 
877
 
 
878
        ret = drm_connector_property_set_value(connector, property, val);
 
879
        if (ret)
 
880
                return ret;
 
881
 
 
882
        if (property == dev_priv->force_audio_property) {
 
883
                enum hdmi_force_audio i = val;
 
884
                bool has_audio;
 
885
 
 
886
                if (i == intel_hdmi->force_audio)
 
887
                        return 0;
 
888
 
 
889
                intel_hdmi->force_audio = i;
 
890
 
 
891
                if (i == HDMI_AUDIO_AUTO)
 
892
                        has_audio = intel_hdmi_detect_audio(connector);
 
893
                else
 
894
                        has_audio = (i == HDMI_AUDIO_ON);
 
895
 
 
896
                if (i == HDMI_AUDIO_OFF_DVI)
 
897
                        intel_hdmi->has_hdmi_sink = 0;
 
898
 
 
899
                intel_hdmi->has_audio = has_audio;
 
900
                goto done;
 
901
        }
 
902
 
 
903
        if (property == dev_priv->broadcast_rgb_property) {
 
904
                if (val == !!intel_hdmi->color_range)
 
905
                        return 0;
 
906
 
 
907
                intel_hdmi->color_range = val ? SDVO_COLOR_RANGE_16_235 : 0;
 
908
                goto done;
 
909
        }
 
910
 
 
911
        return -EINVAL;
 
912
 
 
913
done:
 
914
        if (intel_dig_port->base.base.crtc) {
 
915
                struct drm_crtc *crtc = intel_dig_port->base.base.crtc;
 
916
                intel_set_mode(crtc, &crtc->mode,
 
917
                               crtc->x, crtc->y, crtc->fb);
 
918
        }
 
919
 
 
920
        return 0;
 
921
}
 
922
 
 
923
static void intel_hdmi_destroy(struct drm_connector *connector)
 
924
{
 
925
        drm_sysfs_connector_remove(connector);
 
926
        drm_connector_cleanup(connector);
 
927
        kfree(connector);
 
928
}
 
929
 
 
930
static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = {
 
931
        .mode_fixup = intel_hdmi_mode_fixup,
 
932
        .mode_set = intel_hdmi_mode_set,
 
933
        .disable = intel_encoder_noop,
 
934
};
 
935
 
 
936
static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
 
937
        .dpms = intel_connector_dpms,
 
938
        .detect = intel_hdmi_detect,
 
939
        .fill_modes = drm_helper_probe_single_connector_modes,
 
940
        .set_property = intel_hdmi_set_property,
 
941
        .destroy = intel_hdmi_destroy,
 
942
};
 
943
 
 
944
static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = {
 
945
        .get_modes = intel_hdmi_get_modes,
 
946
        .mode_valid = intel_hdmi_mode_valid,
 
947
        .best_encoder = intel_best_encoder,
 
948
};
 
949
 
 
950
static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
 
951
        .destroy = intel_encoder_destroy,
 
952
};
 
953
 
 
954
static void
 
955
intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector)
 
956
{
 
957
        intel_attach_force_audio_property(connector);
 
958
        intel_attach_broadcast_rgb_property(connector);
 
959
}
 
960
 
 
961
void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 
962
                               struct intel_connector *intel_connector)
 
963
{
 
964
        struct drm_connector *connector = &intel_connector->base;
 
965
        struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
 
966
        struct intel_encoder *intel_encoder = &intel_dig_port->base;
 
967
        struct drm_device *dev = intel_encoder->base.dev;
 
968
        struct drm_i915_private *dev_priv = dev->dev_private;
 
969
        enum port port = intel_dig_port->port;
 
970
 
 
971
        drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
 
972
                           DRM_MODE_CONNECTOR_HDMIA);
 
973
        drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
 
974
 
 
975
        connector->polled = DRM_CONNECTOR_POLL_HPD;
 
976
        connector->interlace_allowed = 1;
 
977
        connector->doublescan_allowed = 0;
 
978
 
 
979
        switch (port) {
 
980
        case PORT_B:
 
981
                intel_hdmi->ddc_bus = GMBUS_PORT_DPB;
 
982
                dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
 
983
                break;
 
984
        case PORT_C:
 
985
                intel_hdmi->ddc_bus = GMBUS_PORT_DPC;
 
986
                dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
 
987
                break;
 
988
        case PORT_D:
 
989
                intel_hdmi->ddc_bus = GMBUS_PORT_DPD;
 
990
                dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS;
 
991
                break;
 
992
        case PORT_A:
 
993
                /* Internal port only for eDP. */
 
994
        default:
 
995
                BUG();
 
996
        }
 
997
 
 
998
        if (!HAS_PCH_SPLIT(dev)) {
 
999
                intel_hdmi->write_infoframe = g4x_write_infoframe;
 
1000
                intel_hdmi->set_infoframes = g4x_set_infoframes;
 
1001
        } else if (IS_VALLEYVIEW(dev)) {
 
1002
                intel_hdmi->write_infoframe = vlv_write_infoframe;
 
1003
                intel_hdmi->set_infoframes = vlv_set_infoframes;
 
1004
        } else if (IS_HASWELL(dev)) {
 
1005
                intel_hdmi->write_infoframe = hsw_write_infoframe;
 
1006
                intel_hdmi->set_infoframes = hsw_set_infoframes;
 
1007
        } else if (HAS_PCH_IBX(dev)) {
 
1008
                intel_hdmi->write_infoframe = ibx_write_infoframe;
 
1009
                intel_hdmi->set_infoframes = ibx_set_infoframes;
 
1010
        } else {
 
1011
                intel_hdmi->write_infoframe = cpt_write_infoframe;
 
1012
                intel_hdmi->set_infoframes = cpt_set_infoframes;
 
1013
        }
 
1014
 
 
1015
        if (IS_HASWELL(dev))
 
1016
                intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;
 
1017
        else
 
1018
                intel_connector->get_hw_state = intel_connector_get_hw_state;
 
1019
 
 
1020
        intel_hdmi_add_properties(intel_hdmi, connector);
 
1021
 
 
1022
        intel_connector_attach_encoder(intel_connector, intel_encoder);
 
1023
        drm_sysfs_connector_add(connector);
 
1024
 
 
1025
        /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
 
1026
         * 0xd.  Failure to do so will result in spurious interrupts being
 
1027
         * generated on the port when a cable is not attached.
 
1028
         */
 
1029
        if (IS_G4X(dev) && !IS_GM45(dev)) {
 
1030
                u32 temp = I915_READ(PEG_BAND_GAP_DATA);
 
1031
                I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
 
1032
        }
 
1033
}
 
1034
 
 
1035
void intel_hdmi_init(struct drm_device *dev, int sdvox_reg, enum port port)
 
1036
{
 
1037
        struct intel_digital_port *intel_dig_port;
 
1038
        struct intel_encoder *intel_encoder;
 
1039
        struct drm_encoder *encoder;
 
1040
        struct intel_connector *intel_connector;
 
1041
 
 
1042
        intel_dig_port = kzalloc(sizeof(struct intel_digital_port), GFP_KERNEL);
 
1043
        if (!intel_dig_port)
 
1044
                return;
 
1045
 
 
1046
        intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
 
1047
        if (!intel_connector) {
 
1048
                kfree(intel_dig_port);
 
1049
                return;
 
1050
        }
 
1051
 
 
1052
        intel_encoder = &intel_dig_port->base;
 
1053
        encoder = &intel_encoder->base;
 
1054
 
 
1055
        drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs,
 
1056
                         DRM_MODE_ENCODER_TMDS);
 
1057
        drm_encoder_helper_add(&intel_encoder->base, &intel_hdmi_helper_funcs);
 
1058
 
 
1059
        intel_encoder->enable = intel_enable_hdmi;
 
1060
        intel_encoder->disable = intel_disable_hdmi;
 
1061
        intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
 
1062
 
 
1063
        intel_encoder->type = INTEL_OUTPUT_HDMI;
 
1064
        intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
 
1065
        intel_encoder->cloneable = false;
 
1066
 
 
1067
        intel_dig_port->port = port;
 
1068
        intel_dig_port->hdmi.sdvox_reg = sdvox_reg;
 
1069
        intel_dig_port->dp.output_reg = 0;
 
1070
 
 
1071
        intel_hdmi_init_connector(intel_dig_port, intel_connector);
 
1072
}