diff --git a/[refs] b/[refs] index f6faa1918401..900787b5369d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c7523a7c88db637d66841018532cb4b3ab6ab0a8 +refs/heads/master: 50744dee010657f0e0bd97e32651061109f1207a diff --git a/trunk/Documentation/ABI/testing/sysfs-driver-wacom b/trunk/Documentation/ABI/testing/sysfs-driver-wacom index 8d55a83d6921..56c54558c8a4 100644 --- a/trunk/Documentation/ABI/testing/sysfs-driver-wacom +++ b/trunk/Documentation/ABI/testing/sysfs-driver-wacom @@ -23,10 +23,9 @@ Contact: linux-input@vger.kernel.org Description: Attribute group for control of the status LEDs and the OLEDs. This attribute group is only available for Intuos 4 M, L, - and XL (with LEDs and OLEDs), Intuos 5 (LEDs only), and Cintiq - 21UX2 and Cintiq 24HD (LEDs only). Therefore its presence - implicitly signifies the presence of said LEDs and OLEDs on the - tablet device. + and XL (with LEDs and OLEDs) and Cintiq 21UX2 and Cintiq 24HD + (LEDs only). Therefore its presence implicitly signifies the + presence of said LEDs and OLEDs on the tablet device. What: /sys/bus/usb/devices/-:./wacom_led/status0_luminance Date: August 2011 @@ -49,10 +48,10 @@ What: /sys/bus/usb/devices/-:./wacom_led/status_led0 Date: August 2011 Contact: linux-input@vger.kernel.org Description: - Writing to this file sets which one of the four (for Intuos 4 - and Intuos 5) or of the right four (for Cintiq 21UX2 and Cintiq - 24HD) status LEDs is active (0..3). The other three LEDs on the - same side are always inactive. + Writing to this file sets which one of the four (for Intuos 4) + or of the right four (for Cintiq 21UX2 and Cintiq 24HD) status + LEDs is active (0..3). The other three LEDs on the same side are + always inactive. What: /sys/bus/usb/devices/-:./wacom_led/status_led1_select Date: September 2011 diff --git a/trunk/Documentation/DocBook/media/Makefile b/trunk/Documentation/DocBook/media/Makefile index 362520992ced..6628b4b9cac4 100644 --- a/trunk/Documentation/DocBook/media/Makefile +++ b/trunk/Documentation/DocBook/media/Makefile @@ -70,8 +70,6 @@ IOCTLS = \ VIDIOC_SUBDEV_ENUM_MBUS_CODE \ VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ - VIDIOC_SUBDEV_G_SELECTION \ - VIDIOC_SUBDEV_S_SELECTION \ TYPES = \ $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) \ @@ -195,7 +193,7 @@ DVB_DOCUMENTED = \ # install_media_images = \ - $(Q)cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api + $(Q)cp $(OBJIMGFILES) $(MEDIA_OBJ_DIR)/media_api $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64 $(Q)base64 -d $< >$@ diff --git a/trunk/Documentation/DocBook/media/dvb/dvbproperty.xml b/trunk/Documentation/DocBook/media/dvb/dvbproperty.xml index e633c097a8d1..c7a4ca517859 100644 --- a/trunk/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/trunk/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -531,139 +531,6 @@ typedef enum fe_delivery_system { here are referring to what can be found in the TMCC-structure - independent of the mode. -
- <constant>DTV_ATSCMH_FIC_VER</constant> - Version number of the FIC (Fast Information Channel) signaling data. - FIC is used for relaying information to allow rapid service acquisition by the receiver. - Possible values: 0, 1, 2, 3, ..., 30, 31 -
-
- <constant>DTV_ATSCMH_PARADE_ID</constant> - Parade identification number - A parade is a collection of up to eight MH groups, conveying one or two ensembles. - Possible values: 0, 1, 2, 3, ..., 126, 127 -
-
- <constant>DTV_ATSCMH_NOG</constant> - Number of MH groups per MH subframe for a designated parade. - Possible values: 1, 2, 3, 4, 5, 6, 7, 8 -
-
- <constant>DTV_ATSCMH_TNOG</constant> - Total number of MH groups including all MH groups belonging to all MH parades in one MH subframe. - Possible values: 0, 1, 2, 3, ..., 30, 31 -
-
- <constant>DTV_ATSCMH_SGN</constant> - Start group number. - Possible values: 0, 1, 2, 3, ..., 14, 15 -
-
- <constant>DTV_ATSCMH_PRC</constant> - Parade repetition cycle. - Possible values: 1, 2, 3, 4, 5, 6, 7, 8 -
-
- <constant>DTV_ATSCMH_RS_FRAME_MODE</constant> - RS frame mode. - Possible values are: - -typedef enum atscmh_rs_frame_mode { - ATSCMH_RSFRAME_PRI_ONLY = 0, - ATSCMH_RSFRAME_PRI_SEC = 1, -} atscmh_rs_frame_mode_t; - -
-
- <constant>DTV_ATSCMH_RS_FRAME_ENSEMBLE</constant> - RS frame ensemble. - Possible values are: - -typedef enum atscmh_rs_frame_ensemble { - ATSCMH_RSFRAME_ENS_PRI = 0, - ATSCMH_RSFRAME_ENS_SEC = 1, -} atscmh_rs_frame_ensemble_t; - -
-
- <constant>DTV_ATSCMH_RS_CODE_MODE_PRI</constant> - RS code mode (primary). - Possible values are: - -typedef enum atscmh_rs_code_mode { - ATSCMH_RSCODE_211_187 = 0, - ATSCMH_RSCODE_223_187 = 1, - ATSCMH_RSCODE_235_187 = 2, -} atscmh_rs_code_mode_t; - -
-
- <constant>DTV_ATSCMH_RS_CODE_MODE_SEC</constant> - RS code mode (secondary). - Possible values are: - -typedef enum atscmh_rs_code_mode { - ATSCMH_RSCODE_211_187 = 0, - ATSCMH_RSCODE_223_187 = 1, - ATSCMH_RSCODE_235_187 = 2, -} atscmh_rs_code_mode_t; - -
-
- <constant>DTV_ATSCMH_SCCC_BLOCK_MODE</constant> - Series Concatenated Convolutional Code Block Mode. - Possible values are: - -typedef enum atscmh_sccc_block_mode { - ATSCMH_SCCC_BLK_SEP = 0, - ATSCMH_SCCC_BLK_COMB = 1, -} atscmh_sccc_block_mode_t; - -
-
- <constant>DTV_ATSCMH_SCCC_CODE_MODE_A</constant> - Series Concatenated Convolutional Code Rate. - Possible values are: - -typedef enum atscmh_sccc_code_mode { - ATSCMH_SCCC_CODE_HLF = 0, - ATSCMH_SCCC_CODE_QTR = 1, -} atscmh_sccc_code_mode_t; - -
-
- <constant>DTV_ATSCMH_SCCC_CODE_MODE_B</constant> - Series Concatenated Convolutional Code Rate. - Possible values are: - -typedef enum atscmh_sccc_code_mode { - ATSCMH_SCCC_CODE_HLF = 0, - ATSCMH_SCCC_CODE_QTR = 1, -} atscmh_sccc_code_mode_t; - -
-
- <constant>DTV_ATSCMH_SCCC_CODE_MODE_C</constant> - Series Concatenated Convolutional Code Rate. - Possible values are: - -typedef enum atscmh_sccc_code_mode { - ATSCMH_SCCC_CODE_HLF = 0, - ATSCMH_SCCC_CODE_QTR = 1, -} atscmh_sccc_code_mode_t; - -
-
- <constant>DTV_ATSCMH_SCCC_CODE_MODE_D</constant> - Series Concatenated Convolutional Code Rate. - Possible values are: - -typedef enum atscmh_sccc_code_mode { - ATSCMH_SCCC_CODE_HLF = 0, - ATSCMH_SCCC_CODE_QTR = 1, -} atscmh_sccc_code_mode_t; - -
<constant>DTV_API_VERSION</constant> @@ -907,33 +774,6 @@ typedef enum fe_hierarchy { DTV_BANDWIDTH_HZ
-
- ATSC-MH delivery system - The following parameters are valid for ATSC-MH: - - DTV_API_VERSION - DTV_DELIVERY_SYSTEM - DTV_TUNE - DTV_CLEAR - DTV_FREQUENCY - DTV_BANDWIDTH_HZ - DTV_ATSCMH_FIC_VER - DTV_ATSCMH_PARADE_ID - DTV_ATSCMH_NOG - DTV_ATSCMH_TNOG - DTV_ATSCMH_SGN - DTV_ATSCMH_PRC - DTV_ATSCMH_RS_FRAME_MODE - DTV_ATSCMH_RS_FRAME_ENSEMBLE - DTV_ATSCMH_CODE_MODE_PRI - DTV_ATSCMH_CODE_MODE_SEC - DTV_ATSCMH_SCCC_BLOCK_MODE - DTV_ATSCMH_SCCC_CODE_MODE_A - DTV_ATSCMH_SCCC_CODE_MODE_B - DTV_ATSCMH_SCCC_CODE_MODE_C - DTV_ATSCMH_SCCC_CODE_MODE_D - -
Properties used on cable delivery systems diff --git a/trunk/Documentation/DocBook/media/v4l/biblio.xml b/trunk/Documentation/DocBook/media/v4l/biblio.xml index 7c49facecd25..7dc65c592a87 100644 --- a/trunk/Documentation/DocBook/media/v4l/biblio.xml +++ b/trunk/Documentation/DocBook/media/v4l/biblio.xml @@ -197,33 +197,4 @@ in the frequency range from 87,5 to 108,0 MHz NTSC-4: United States RBDS Standard - - ISO 12232:2006 - - International Organization for Standardization -(http://www.iso.org) - - Photography — Digital still cameras — Determination - of exposure index, ISO speed ratings, standard output sensitivity, and - recommended exposure index - - - - CEA-861-E - - Consumer Electronics Association -(http://www.ce.org) - - A DTV Profile for Uncompressed High Speed Digital Interfaces - - - - VESA DMT - - Video Electronics Standards Association -(http://www.vesa.org) - - VESA and Industry Standards and Guidelines for Computer Display Monitor Timing (DMT) - - diff --git a/trunk/Documentation/DocBook/media/v4l/common.xml b/trunk/Documentation/DocBook/media/v4l/common.xml index 4101aeb56540..c79278acfb0e 100644 --- a/trunk/Documentation/DocBook/media/v4l/common.xml +++ b/trunk/Documentation/DocBook/media/v4l/common.xml @@ -724,49 +724,41 @@ if (-1 == ioctl (fd, &VIDIOC-S-STD;, &std_id)) { } -
Digital Video (DV) Timings - The video standards discussed so far have been dealing with Analog TV and the + The video standards discussed so far has been dealing with Analog TV and the corresponding video timings. Today there are many more different hardware interfaces such as High Definition TV interfaces (HDMI), VGA, DVI connectors etc., that carry video signals and there is a need to extend the API to select the video timings for these interfaces. Since it is not possible to extend the &v4l2-std-id; due to -the limited bits available, a new set of IOCTLs was added to set/get video timings at +the limited bits available, a new set of IOCTLs is added to set/get video timings at the input and output: - DV Timings: This will allow applications to define detailed -video timings for the interface. This includes parameters such as width, height, -polarities, frontporch, backporch etc. The linux/v4l2-dv-timings.h -header can be used to get the timings of the formats in the and - standards. - - - - DV Presets: Digital Video (DV) presets (deprecated). - These are IDs representing a + DV Presets: Digital Video (DV) presets. These are IDs representing a video timing at the input/output. Presets are pre-defined timings implemented by the hardware according to video standards. A __u32 data type is used to represent a preset unlike the bit mask that is used in &v4l2-std-id; allowing future extensions -to support as many different presets as needed. This API is deprecated in favor of the DV Timings -API. +to support as many different presets as needed. + + + Custom DV Timings: This will allow applications to define more detailed +custom video timings for the interface. This includes parameters such as width, height, +polarities, frontporch, backporch etc. + - To enumerate and query the attributes of the DV timings supported by a device, - applications use the &VIDIOC-ENUM-DV-TIMINGS; and &VIDIOC-DV-TIMINGS-CAP; ioctls. - To set DV timings for the device, applications use the -&VIDIOC-S-DV-TIMINGS; ioctl and to get current DV timings they use the -&VIDIOC-G-DV-TIMINGS; ioctl. To detect the DV timings as seen by the video receiver applications -use the &VIDIOC-QUERY-DV-TIMINGS; ioctl. To enumerate and query the attributes of DV presets supported by a device, applications use the &VIDIOC-ENUM-DV-PRESETS; ioctl. To get the current DV preset, applications use the &VIDIOC-G-DV-PRESET; ioctl and to set a preset they use the -&VIDIOC-S-DV-PRESET; ioctl. To detect the preset as seen by the video receiver applications -use the &VIDIOC-QUERY-DV-PRESET; ioctl. +&VIDIOC-S-DV-PRESET; ioctl. + To set custom DV timings for the device, applications use the +&VIDIOC-S-DV-TIMINGS; ioctl and to get current custom DV timings they use the +&VIDIOC-G-DV-TIMINGS; ioctl. Applications can make use of the and flags to decide what ioctls are available to set the video timings for the device. +
&sub-controls; diff --git a/trunk/Documentation/DocBook/media/v4l/compat.xml b/trunk/Documentation/DocBook/media/v4l/compat.xml index ea42ef824948..bce97c50391b 100644 --- a/trunk/Documentation/DocBook/media/v4l/compat.xml +++ b/trunk/Documentation/DocBook/media/v4l/compat.xml @@ -2407,54 +2407,6 @@ details. Added JPEG compression control class. - - Extended the DV Timings API: - &VIDIOC-ENUM-DV-TIMINGS;, &VIDIOC-QUERY-DV-TIMINGS; and - &VIDIOC-DV-TIMINGS-CAP;. - - - - -
- V4L2 in Linux 3.5 - - - Added integer menus, the new type will be - V4L2_CTRL_TYPE_INTEGER_MENU. - - - Added selection API for V4L2 subdev interface: - &VIDIOC-SUBDEV-G-SELECTION; and - &VIDIOC-SUBDEV-S-SELECTION;. - - - Added V4L2_COLORFX_ANTIQUE, - V4L2_COLORFX_ART_FREEZE, - V4L2_COLORFX_AQUA, - V4L2_COLORFX_SILHOUETTE, - V4L2_COLORFX_SOLARIZATION, - V4L2_COLORFX_VIVID and - V4L2_COLORFX_ARBITRARY_CBCR menu items - to the V4L2_CID_COLORFX control. - - - Added V4L2_CID_COLORFX_CBCR control. - - - Added camera controls V4L2_CID_AUTO_EXPOSURE_BIAS, - V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, - V4L2_CID_IMAGE_STABILIZATION, - V4L2_CID_ISO_SENSITIVITY, - V4L2_CID_ISO_SENSITIVITY_AUTO, - V4L2_CID_EXPOSURE_METERING, - V4L2_CID_SCENE_MODE, - V4L2_CID_3A_LOCK, - V4L2_CID_AUTO_FOCUS_START, - V4L2_CID_AUTO_FOCUS_STOP, - V4L2_CID_AUTO_FOCUS_STATUS and - V4L2_CID_AUTO_FOCUS_RANGE. - -
@@ -2553,10 +2505,6 @@ and may change in the future. &VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; -ioctls. - - - &VIDIOC-DECODER-CMD; and &VIDIOC-TRY-DECODER-CMD; ioctls. @@ -2566,10 +2514,6 @@ ioctls. &VIDIOC-DBG-G-CHIP-IDENT; ioctl. - - &VIDIOC-ENUM-DV-TIMINGS;, &VIDIOC-QUERY-DV-TIMINGS; and - &VIDIOC-DV-TIMINGS-CAP; ioctls. - Flash API. @@ -2579,14 +2523,6 @@ ioctls. Selection API. - - Sub-device selection API: &VIDIOC-SUBDEV-G-SELECTION; - and &VIDIOC-SUBDEV-S-SELECTION; ioctls. - - - - V4L2_CID_AUTO_FOCUS_AREA control. - @@ -2602,17 +2538,6 @@ interfaces and should not be implemented in new drivers. VIDIOC_S_MPEGCOMP ioctls. Use Extended Controls, . - - &VIDIOC-G-DV-PRESET;, &VIDIOC-S-DV-PRESET;, &VIDIOC-ENUM-DV-PRESETS; and - &VIDIOC-QUERY-DV-PRESET; ioctls. Use the DV Timings API (). - - - VIDIOC_SUBDEV_G_CROP and - VIDIOC_SUBDEV_S_CROP ioctls. Use - VIDIOC_SUBDEV_G_SELECTION and - VIDIOC_SUBDEV_S_SELECTION, . - diff --git a/trunk/Documentation/DocBook/media/v4l/controls.xml b/trunk/Documentation/DocBook/media/v4l/controls.xml index 676bc46f9c52..dd03cf4a6539 100644 --- a/trunk/Documentation/DocBook/media/v4l/controls.xml +++ b/trunk/Documentation/DocBook/media/v4l/controls.xml @@ -285,92 +285,18 @@ minimum value disables backlight compensation. V4L2_CID_COLORFX enum - Selects a color effect. The following values are defined: - - - - - - - - V4L2_COLORFX_NONE  - Color effect is disabled. - - - V4L2_COLORFX_ANTIQUE  - An aging (old photo) effect. - - - V4L2_COLORFX_ART_FREEZE  - Frost color effect. - - - V4L2_COLORFX_AQUA  - Water color, cool tone. - - - V4L2_COLORFX_BW  - Black and white. - - - V4L2_COLORFX_EMBOSS  - Emboss, the highlights and shadows replace light/dark boundaries - and low contrast areas are set to a gray background. - - - V4L2_COLORFX_GRASS_GREEN  - Grass green. - - - V4L2_COLORFX_NEGATIVE  - Negative. - - - V4L2_COLORFX_SEPIA  - Sepia tone. - - - V4L2_COLORFX_SKETCH  - Sketch. - - - V4L2_COLORFX_SKIN_WHITEN  - Skin whiten. - - - V4L2_COLORFX_SKY_BLUE  - Sky blue. - - - V4L2_COLORFX_SOLARIZATION  - Solarization, the image is partially reversed in tone, - only color values above or below a certain threshold are inverted. - - - - V4L2_COLORFX_SILHOUETTE  - Silhouette (outline). - - - V4L2_COLORFX_VIVID  - Vivid colors. - - - V4L2_COLORFX_SET_CBCR  - The Cb and Cr chroma components are replaced by fixed - coefficients determined by V4L2_CID_COLORFX_CBCR - control. - - - - - - V4L2_CID_COLORFX_CBCR - integer - Determines the Cb and Cr coefficients for V4L2_COLORFX_SET_CBCR - color effect. Bits [7:0] of the supplied 32 bit value are interpreted as - Cr component, bits [15:8] as Cb component and bits [31:16] must be zero. - + Selects a color effect. Possible values for +enum v4l2_colorfx are: +V4L2_COLORFX_NONE (0), +V4L2_COLORFX_BW (1), +V4L2_COLORFX_SEPIA (2), +V4L2_COLORFX_NEGATIVE (3), +V4L2_COLORFX_EMBOSS (4), +V4L2_COLORFX_SKETCH (5), +V4L2_COLORFX_SKY_BLUE (6), +V4L2_COLORFX_GRASS_GREEN (7), +V4L2_COLORFX_SKIN_WHITEN (8) and +V4L2_COLORFX_VIVID (9). V4L2_CID_ROTATE @@ -2848,51 +2774,6 @@ remain constant. - - V4L2_CID_EXPOSURE_BIAS  - integer menu - Determines the automatic -exposure compensation, it is effective only when V4L2_CID_EXPOSURE_AUTO -control is set to AUTO, SHUTTER_PRIORITY -or APERTURE_PRIORITY. -It is expressed in terms of EV, drivers should interpret the values as 0.001 EV -units, where the value 1000 stands for +1 EV. -Increasing the exposure compensation value is equivalent to decreasing -the exposure value (EV) and will increase the amount of light at the image -sensor. The camera performs the exposure compensation by adjusting absolute -exposure time and/or aperture. - - - - - V4L2_CID_EXPOSURE_METERING  - enum v4l2_exposure_metering - Determines how the camera measures -the amount of light available for the frame exposure. Possible values are: - - - - - - V4L2_EXPOSURE_METERING_AVERAGE  - Use the light information coming from the entire frame -and average giving no weighting to any particular portion of the metered area. - - - - V4L2_EXPOSURE_METERING_CENTER_WEIGHTED  - Average the light information coming from the entire frame -giving priority to the center of the metered area. - - - V4L2_EXPOSURE_METERING_SPOT  - Measure only very small area at the center of the frame. - - - - - - V4L2_CID_PAN_RELATIVE  integer @@ -2976,106 +2857,12 @@ negative values towards infinity. This is a write-only control. V4L2_CID_FOCUS_AUTO  boolean - Enables continuous automatic -focus adjustments. The effect of manual focus adjustments while this feature + Enables automatic focus +adjustments. The effect of manual focus adjustments while this feature is enabled is undefined, drivers should ignore such requests. - - V4L2_CID_AUTO_FOCUS_START  - button - Starts single auto focus process. -The effect of setting this control when V4L2_CID_FOCUS_AUTO -is set to TRUE (1) is undefined, drivers should ignore -such requests. - - - - - V4L2_CID_AUTO_FOCUS_STOP  - button - Aborts automatic focusing -started with V4L2_CID_AUTO_FOCUS_START control. It is -effective only when the continuous autofocus is disabled, that is when -V4L2_CID_FOCUS_AUTO control is set to FALSE - (0). - - - - - - V4L2_CID_AUTO_FOCUS_STATUS  - bitmask - - The automatic focus status. This is a read-only - control. - - - - - - V4L2_AUTO_FOCUS_STATUS_IDLE  - Automatic focus is not active. - - - V4L2_AUTO_FOCUS_STATUS_BUSY  - Automatic focusing is in progress. - - - V4L2_AUTO_FOCUS_STATUS_REACHED  - Focus has been reached. - - - V4L2_AUTO_FOCUS_STATUS_FAILED  - Automatic focus has failed, the driver will not - transition from this state until another action is - performed by an application. - - - - - -Setting V4L2_LOCK_FOCUS lock bit of the V4L2_CID_3A_LOCK - control may stop updates of the V4L2_CID_AUTO_FOCUS_STATUS -control value. - - - - - - V4L2_CID_AUTO_FOCUS_RANGE  - enum v4l2_auto_focus_range - - Determines auto focus distance range -for which lens may be adjusted. - - - - - - V4L2_AUTO_FOCUS_RANGE_AUTO  - The camera automatically selects the focus range. - - - V4L2_AUTO_FOCUS_RANGE_NORMAL  - Normal distance range, limited for best automatic focus -performance. - - - V4L2_AUTO_FOCUS_RANGE_MACRO  - Macro (close-up) auto focus. The camera will -use its minimum possible distance for auto focus. - - - V4L2_AUTO_FOCUS_RANGE_INFINITY  - The lens is set to focus on an object at infinite distance. - - - - - - V4L2_CID_ZOOM_ABSOLUTE  integer @@ -3145,295 +2932,6 @@ camera sensor on or off, or specify its strength. Such band-stop filters can be used, for example, to filter out the fluorescent light component. - - - V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE  - enum v4l2_auto_n_preset_white_balance - Sets white balance to automatic, -manual or a preset. The presets determine color temperature of the light as -a hint to the camera for white balance adjustments resulting in most accurate -color representation. The following white balance presets are listed in order -of increasing color temperature. - - - - - - V4L2_WHITE_BALANCE_MANUAL  - Manual white balance. - - - V4L2_WHITE_BALANCE_AUTO  - Automatic white balance adjustments. - - - V4L2_WHITE_BALANCE_INCANDESCENT  - White balance setting for incandescent (tungsten) lighting. -It generally cools down the colors and corresponds approximately to 2500...3500 K -color temperature range. - - - V4L2_WHITE_BALANCE_FLUORESCENT  - White balance preset for fluorescent lighting. -It corresponds approximately to 4000...5000 K color temperature. - - - V4L2_WHITE_BALANCE_FLUORESCENT_H  - With this setting the camera will compensate for -fluorescent H lighting. - - - V4L2_WHITE_BALANCE_HORIZON  - White balance setting for horizon daylight. -It corresponds approximately to 5000 K color temperature. - - - V4L2_WHITE_BALANCE_DAYLIGHT  - White balance preset for daylight (with clear sky). -It corresponds approximately to 5000...6500 K color temperature. - - - V4L2_WHITE_BALANCE_FLASH  - With this setting the camera will compensate for the flash -light. It slightly warms up the colors and corresponds roughly to 5000...5500 K -color temperature. - - - V4L2_WHITE_BALANCE_CLOUDY  - White balance preset for moderately overcast sky. -This option corresponds approximately to 6500...8000 K color temperature -range. - - - V4L2_WHITE_BALANCE_SHADE  - White balance preset for shade or heavily overcast -sky. It corresponds approximately to 9000...10000 K color temperature. - - - - - - - - - V4L2_CID_WIDE_DYNAMIC_RANGE - boolean - - - Enables or disables the camera's wide dynamic -range feature. This feature allows to obtain clear images in situations where -intensity of the illumination varies significantly throughout the scene, i.e. -there are simultaneously very dark and very bright areas. It is most commonly -realized in cameras by combining two subsequent frames with different exposure -times. This control may be changed to a menu -control in the future, if more options are required. - - - - - V4L2_CID_IMAGE_STABILIZATION - boolean - - - Enables or disables image stabilization. - - - - - - V4L2_CID_ISO_SENSITIVITY  - integer menu - Determines ISO equivalent of an -image sensor indicating the sensor's sensitivity to light. The numbers are -expressed in arithmetic scale, as per standard, -where doubling the sensor sensitivity is represented by doubling the numerical -ISO value. Applications should interpret the values as standard ISO values -multiplied by 1000, e.g. control value 800 stands for ISO 0.8. Drivers will -usually support only a subset of standard ISO values. The effect of setting -this control while the V4L2_CID_ISO_SENSITIVITY_AUTO -control is set to a value other than V4L2_CID_ISO_SENSITIVITY_MANUAL - is undefined, drivers should ignore such requests. - - - - - V4L2_CID_ISO_SENSITIVITY_AUTO  - enum v4l2_iso_sensitivity_type - Enables or disables automatic ISO -sensitivity adjustments. - - - - - - V4L2_CID_ISO_SENSITIVITY_MANUAL  - Manual ISO sensitivity. - - - V4L2_CID_ISO_SENSITIVITY_AUTO  - Automatic ISO sensitivity adjustments. - - - - - - - - V4L2_CID_SCENE_MODE  - enum v4l2_scene_mode - This control allows to select -scene programs as the camera automatic modes optimized for common shooting -scenes. Within these modes the camera determines best exposure, aperture, -focusing, light metering, white balance and equivalent sensitivity. The -controls of those parameters are influenced by the scene mode control. -An exact behavior in each mode is subject to the camera specification. - -When the scene mode feature is not used, this control should be set to -V4L2_SCENE_MODE_NONE to make sure the other possibly -related controls are accessible. The following scene programs are defined: - - - - - - - - V4L2_SCENE_MODE_NONE  - The scene mode feature is disabled. - - - V4L2_SCENE_MODE_BACKLIGHT  - Backlight. Compensates for dark shadows when light is - coming from behind a subject, also by automatically turning - on the flash. - - - V4L2_SCENE_MODE_BEACH_SNOW  - Beach and snow. This mode compensates for all-white or -bright scenes, which tend to look gray and low contrast, when camera's automatic -exposure is based on an average scene brightness. To compensate, this mode -automatically slightly overexposes the frames. The white balance may also be -adjusted to compensate for the fact that reflected snow looks bluish rather -than white. - - - V4L2_SCENE_MODE_CANDLELIGHT  - Candle light. The camera generally raises the ISO -sensitivity and lowers the shutter speed. This mode compensates for relatively -close subject in the scene. The flash is disabled in order to preserve the -ambiance of the light. - - - V4L2_SCENE_MODE_DAWN_DUSK  - Dawn and dusk. Preserves the colors seen in low -natural light before dusk and after down. The camera may turn off the flash, -and automatically focus at infinity. It will usually boost saturation and -lower the shutter speed. - - - V4L2_SCENE_MODE_FALL_COLORS  - Fall colors. Increases saturation and adjusts white -balance for color enhancement. Pictures of autumn leaves get saturated reds -and yellows. - - - V4L2_SCENE_MODE_FIREWORKS  - Fireworks. Long exposure times are used to capture -the expanding burst of light from a firework. The camera may invoke image -stabilization. - - - V4L2_SCENE_MODE_LANDSCAPE  - Landscape. The camera may choose a small aperture to -provide deep depth of field and long exposure duration to help capture detail -in dim light conditions. The focus is fixed at infinity. Suitable for distant -and wide scenery. - - - V4L2_SCENE_MODE_NIGHT  - Night, also known as Night Landscape. Designed for low -light conditions, it preserves detail in the dark areas without blowing out bright -objects. The camera generally sets itself to a medium-to-high ISO sensitivity, -with a relatively long exposure time, and turns flash off. As such, there will be -increased image noise and the possibility of blurred image. - - - V4L2_SCENE_MODE_PARTY_INDOOR  - Party and indoor. Designed to capture indoor scenes -that are lit by indoor background lighting as well as the flash. The camera -usually increases ISO sensitivity, and adjusts exposure for the low light -conditions. - - - V4L2_SCENE_MODE_PORTRAIT  - Portrait. The camera adjusts the aperture so that the -depth of field is reduced, which helps to isolate the subject against a smooth -background. Most cameras recognize the presence of faces in the scene and focus -on them. The color hue is adjusted to enhance skin tones. The intensity of the -flash is often reduced. - - - V4L2_SCENE_MODE_SPORTS  - Sports. Significantly increases ISO and uses a fast -shutter speed to freeze motion of rapidly-moving subjects. Increased image -noise may be seen in this mode. - - - V4L2_SCENE_MODE_SUNSET  - Sunset. Preserves deep hues seen in sunsets and -sunrises. It bumps up the saturation. - - - V4L2_SCENE_MODE_TEXT  - Text. It applies extra contrast and sharpness, it is -typically a black-and-white mode optimized for readability. Automatic focus -may be switched to close-up mode and this setting may also involve some -lens-distortion correction. - - - - - - - - V4L2_CID_3A_LOCK - bitmask - - - This control locks or unlocks the automatic -focus, exposure and white balance. The automatic adjustments can be paused -independently by setting the corresponding lock bit to 1. The camera then retains -the settings until the lock bit is cleared. The following lock bits are defined: - - - - - - - V4L2_LOCK_EXPOSURE - Automatic exposure adjustments lock. - - - V4L2_LOCK_WHITE_BALANCE - Automatic white balance adjustments lock. - - - V4L2_LOCK_FOCUS - Automatic focus lock. - - - - - -When a given algorithm is not enabled, drivers should ignore requests -to lock it and should return no error. An example might be an application -setting bit V4L2_LOCK_WHITE_BALANCE when the -V4L2_CID_AUTO_WHITE_BALANCE control is set to -FALSE. The value of this control may be changed -by exposure, white balance or focus controls. - - - @@ -3978,7 +3476,7 @@ interface and may change in the future. V4L2_CID_JPEG_CHROMA_SUBSAMPLING menu - + The chroma subsampling factors describe how each component of an input image is sampled, in respect to maximum sample rate in each spatial dimension. See , @@ -3988,7 +3486,7 @@ interface and may change in the future. from RGB to Y'CbCr color space. - + @@ -4040,12 +3538,12 @@ interface and may change in the future. - V4L2_CID_JPEG_COMPRESSION_QUALITY + V4L2_CID_JPEG_COMPRESION_QUALITY integer - V4L2_CID_JPEG_COMPRESSION_QUALITY control + V4L2_CID_JPEG_COMPRESION_QUALITY control determines trade-off between image quality and size. It provides simpler method for applications to control image quality, without a need for direct reconfiguration of luminance and chrominance @@ -4053,7 +3551,7 @@ interface and may change in the future. In cases where a driver uses quantization tables configured directly by an application, using interfaces defined elsewhere, - V4L2_CID_JPEG_COMPRESSION_QUALITY control should be set + V4L2_CID_JPEG_COMPRESION_QUALITY control should be set by driver to 0. The value range of this control is driver-specific. Only @@ -4101,172 +3599,4 @@ interface and may change in the future. to , , . - -
- Image Source Control Reference - - - Experimental - - This is an experimental interface and may - change in the future. - - - - The Image Source control class is intended for low-level - control of image source devices such as image sensors. The - devices feature an analogue to digital converter and a bus - transmitter to transmit the image data out of the device. - - - - Image Source Control IDs - - - - - - - - - - - ID - Type - Description - - - - - - V4L2_CID_IMAGE_SOURCE_CLASS - class - - - The IMAGE_SOURCE class descriptor. - - - V4L2_CID_VBLANK - integer - - - Vertical blanking. The idle period - after every frame during which no image data is produced. - The unit of vertical blanking is a line. Every line has - length of the image width plus horizontal blanking at the - pixel rate defined by - V4L2_CID_PIXEL_RATE control in the - same sub-device. - - - V4L2_CID_HBLANK - integer - - - Horizontal blanking. The idle - period after every line of image data during which no - image data is produced. The unit of horizontal blanking is - pixels. - - - V4L2_CID_ANALOGUE_GAIN - integer - - - Analogue gain is gain affecting - all colour components in the pixel matrix. The gain - operation is performed in the analogue domain before A/D - conversion. - - - - - -
- -
- -
- Image Process Control Reference - - - Experimental - - This is an experimental interface and may - change in the future. - - - - The Image Source control class is intended for low-level control of - image processing functions. Unlike - V4L2_CID_IMAGE_SOURCE_CLASS, the controls in - this class affect processing the image, and do not control capturing - of it. - - - - Image Source Control IDs - - - - - - - - - - - ID - Type - Description - - - - - - V4L2_CID_IMAGE_PROC_CLASS - class - - - The IMAGE_PROC class descriptor. - - - V4L2_CID_LINK_FREQ - integer menu - - - Data bus frequency. Together with the - media bus pixel code, bus type (clock cycles per sample), the - data bus frequency defines the pixel rate - (V4L2_CID_PIXEL_RATE) in the - pixel array (or possibly elsewhere, if the device is not an - image sensor). The frame rate can be calculated from the pixel - clock, image width and height and horizontal and vertical - blanking. While the pixel rate control may be defined elsewhere - than in the subdev containing the pixel array, the frame rate - cannot be obtained from that information. This is because only - on the pixel array it can be assumed that the vertical and - horizontal blanking information is exact: no other blanking is - allowed in the pixel array. The selection of frame rate is - performed by selecting the desired horizontal and vertical - blanking. The unit of this control is Hz. - - - V4L2_CID_PIXEL_RATE - 64-bit integer - - - Pixel rate in the source pads of - the subdev. This control is read-only and its unit is - pixels / second. - - - - - -
- -
diff --git a/trunk/Documentation/DocBook/media/v4l/dev-subdev.xml b/trunk/Documentation/DocBook/media/v4l/dev-subdev.xml index 4afcbbec5eda..0916a7343a16 100644 --- a/trunk/Documentation/DocBook/media/v4l/dev-subdev.xml +++ b/trunk/Documentation/DocBook/media/v4l/dev-subdev.xml @@ -76,12 +76,11 @@ format means the combination of media bus data format, frame width and frame height. - Image formats are typically negotiated on video capture and - output devices using the format and selection ioctls. The - driver is responsible for configuring every block in the video - pipeline according to the requested format at the pipeline input - and/or output. + Image formats are typically negotiated on video capture and output + devices using the cropping and scaling ioctls. + The driver is responsible for configuring every block in the video pipeline + according to the requested format at the pipeline input and/or + output. For complex devices, such as often found in embedded systems, identical image sizes at the output of a pipeline can be achieved using @@ -277,11 +276,11 @@
- Selections: cropping, scaling and composition + Cropping and scaling Many sub-devices support cropping frames on their input or output pads (or possible even on both). Cropping is used to select the area of - interest in an image, typically on an image sensor or a video decoder. It can + interest in an image, typically on a video sensor or video decoder. It can also be used as part of digital zoom implementations to select the area of the image that will be scaled up. @@ -289,179 +288,26 @@ &v4l2-rect; by the coordinates of the top left corner and the rectangle size. Both the coordinates and sizes are expressed in pixels. - As for pad formats, drivers store try and active - rectangles for the selection targets of ACTUAL type . - - On sink pads, cropping is applied relative to the - current pad format. The pad format represents the image size as - received by the sub-device from the previous block in the - pipeline, and the crop rectangle represents the sub-image that - will be transmitted further inside the sub-device for - processing. - - The scaling operation changes the size of the image by - scaling it to new dimensions. The scaling ratio isn't specified - explicitly, but is implied from the original and scaled image - sizes. Both sizes are represented by &v4l2-rect;. - - Scaling support is optional. When supported by a subdev, - the crop rectangle on the subdev's sink pad is scaled to the - size configured using the &VIDIOC-SUBDEV-S-SELECTION; IOCTL - using V4L2_SUBDEV_SEL_COMPOSE_ACTUAL - selection target on the same pad. If the subdev supports scaling - but not composing, the top and left values are not used and must - always be set to zero. - - On source pads, cropping is similar to sink pads, with the - exception that the source size from which the cropping is - performed, is the COMPOSE rectangle on the sink pad. In both - sink and source pads, the crop rectangle must be entirely - contained inside the source image size for the crop - operation. - - The drivers should always use the closest possible - rectangle the user requests on all selection targets, unless - specifically told otherwise. - V4L2_SUBDEV_SEL_FLAG_SIZE_GE and - V4L2_SUBDEV_SEL_FLAG_SIZE_LE flags may be - used to round the image size either up or down. -
- -
- Types of selection targets - -
- ACTUAL targets - - ACTUAL targets reflect the actual hardware configuration - at any point of time. There is a BOUNDS target - corresponding to every ACTUAL. -
- -
- BOUNDS targets - - BOUNDS targets is the smallest rectangle that contains - all valid ACTUAL rectangles. It may not be possible to set the - ACTUAL rectangle as large as the BOUNDS rectangle, however. - This may be because e.g. a sensor's pixel array is not - rectangular but cross-shaped or round. The maximum size may - also be smaller than the BOUNDS rectangle. -
- -
- -
- Order of configuration and format propagation - - Inside subdevs, the order of image processing steps will - always be from the sink pad towards the source pad. This is also - reflected in the order in which the configuration must be - performed by the user: the changes made will be propagated to - any subsequent stages. If this behaviour is not desired, the - user must set - V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG flag. This - flag causes no propagation of the changes are allowed in any - circumstances. This may also cause the accessed rectangle to be - adjusted by the driver, depending on the properties of the - underlying hardware. - - The coordinates to a step always refer to the actual size - of the previous step. The exception to this rule is the source - compose rectangle, which refers to the sink compose bounds - rectangle --- if it is supported by the hardware. - - - Sink pad format. The user configures the sink pad - format. This format defines the parameters of the image the - entity receives through the pad for further processing. - - Sink pad actual crop selection. The sink pad crop - defines the crop performed to the sink pad format. - - Sink pad actual compose selection. The size of the - sink pad compose rectangle defines the scaling ratio compared - to the size of the sink pad crop rectangle. The location of - the compose rectangle specifies the location of the actual - sink compose rectangle in the sink compose bounds - rectangle. - - Source pad actual crop selection. Crop on the source - pad defines crop performed to the image in the sink compose - bounds rectangle. - - Source pad format. The source pad format defines the - output pixel format of the subdev, as well as the other - parameters with the exception of the image width and height. - Width and height are defined by the size of the source pad - actual crop selection. - + The crop rectangle is retrieved and set using the + &VIDIOC-SUBDEV-G-CROP; and &VIDIOC-SUBDEV-S-CROP; ioctls. Like for pad + formats, drivers store try and active crop rectangles. The format + negotiation mechanism applies to crop settings as well. + + On input pads, cropping is applied relatively to the current pad + format. The pad format represents the image size as received by the + sub-device from the previous block in the pipeline, and the crop rectangle + represents the sub-image that will be transmitted further inside the + sub-device for processing. The crop rectangle be entirely containted + inside the input image size. + + Input crop rectangle are reset to their default value when the input + image format is modified. Drivers should use the input image size as the + crop rectangle default value, but hardware requirements may prevent this. + - Accessing any of the above rectangles not supported by the - subdev will return EINVAL. Any rectangle - referring to a previous unsupported rectangle coordinates will - instead refer to the previous supported rectangle. For example, - if sink crop is not supported, the compose selection will refer - to the sink pad format dimensions instead. - -
- Image processing in subdevs: simple crop example - - - - - -
- - In the above example, the subdev supports cropping on its - sink pad. To configure it, the user sets the media bus format on - the subdev's sink pad. Now the actual crop rectangle can be set - on the sink pad --- the location and size of this rectangle - reflect the location and size of a rectangle to be cropped from - the sink format. The size of the sink crop rectangle will also - be the size of the format of the subdev's source pad. - -
- Image processing in subdevs: scaling with multiple sources - - - - - -
- - In this example, the subdev is capable of first cropping, - then scaling and finally cropping for two source pads - individually from the resulting scaled image. The location of - the scaled image in the cropped image is ignored in sink compose - target. Both of the locations of the source crop rectangles - refer to the sink scaling rectangle, independently cropping an - area at location specified by the source crop rectangle from - it. - -
- Image processing in subdevs: scaling and composition - with multiple sinks and sources - - - - - -
- - The subdev driver supports two sink pads and two source - pads. The images from both of the sink pads are individually - cropped, then scaled and further composed on the composition - bounds rectangle. From that, two independent streams are cropped - and sent out of the subdev from the source pads. + Cropping behaviour on output pads is not defined.
- &sub-subdev-formats; diff --git a/trunk/Documentation/DocBook/media/v4l/io.xml b/trunk/Documentation/DocBook/media/v4l/io.xml index fd6aca2922b6..b815929b5bba 100644 --- a/trunk/Documentation/DocBook/media/v4l/io.xml +++ b/trunk/Documentation/DocBook/media/v4l/io.xml @@ -543,13 +543,12 @@ and can range from zero to the number of buffers allocated with the &VIDIOC-REQBUFS; ioctl (&v4l2-requestbuffers; count) minus one.
- __u32 + &v4l2-buf-type; type Type of the buffer, same as &v4l2-format; type or &v4l2-requestbuffers; -type, set by the application. See +type, set by the application. __u32 @@ -569,7 +568,7 @@ refers to an input stream, applications when an output stream. linkend="buffer-flags" />. - __u32 + &v4l2-field; field Indicates the field order of the image in the @@ -631,12 +630,11 @@ bandwidth. These devices identify by not enumerating any video standards, see . - __u32 + &v4l2-memory; memory This field must be set by applications and/or drivers -in accordance with the selected I/O method. See +in accordance with the selected I/O method. union diff --git a/trunk/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml b/trunk/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml index c1c62a9acc2a..7b274092e60c 100644 --- a/trunk/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml +++ b/trunk/Documentation/DocBook/media/v4l/pixfmt-srggb10.xml @@ -1,4 +1,4 @@ - + V4L2_PIX_FMT_SRGGB10 ('RG10'), V4L2_PIX_FMT_SGRBG10 ('BA10'), diff --git a/trunk/Documentation/DocBook/media/v4l/pixfmt-srggb10dpcm8.xml b/trunk/Documentation/DocBook/media/v4l/pixfmt-srggb10dpcm8.xml deleted file mode 100644 index 8eace3e2e7d4..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/pixfmt-srggb10dpcm8.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - V4L2_PIX_FMT_SBGGR10DPCM8 ('bBA8'), - V4L2_PIX_FMT_SGBRG10DPCM8 ('bGA8'), - V4L2_PIX_FMT_SGRBG10DPCM8 ('BD10'), - V4L2_PIX_FMT_SRGGB10DPCM8 ('bRA8'), - - &manvol; - - - V4L2_PIX_FMT_SBGGR10DPCM8 - V4L2_PIX_FMT_SGBRG10DPCM8 - V4L2_PIX_FMT_SGRBG10DPCM8 - V4L2_PIX_FMT_SRGGB10DPCM8 - 10-bit Bayer formats compressed to 8 bits - - - Description - - The following four pixel formats are raw sRGB / Bayer formats - with 10 bits per colour compressed to 8 bits each, using DPCM - compression. DPCM, differential pulse-code modulation, is lossy. - Each colour component consumes 8 bits of memory. In other respects - this format is similar to . - - - diff --git a/trunk/Documentation/DocBook/media/v4l/pixfmt.xml b/trunk/Documentation/DocBook/media/v4l/pixfmt.xml index f5ac15ed0549..31eaae2469f9 100644 --- a/trunk/Documentation/DocBook/media/v4l/pixfmt.xml +++ b/trunk/Documentation/DocBook/media/v4l/pixfmt.xml @@ -673,7 +673,6 @@ access the palette, this must be done with ioctls of the Linux framebuffer API.< &sub-srggb8; &sub-sbggr16; &sub-srggb10; - &sub-srggb10dpcm8; &sub-srggb12; @@ -877,6 +876,11 @@ kernel sources in the file Documentation/video4linux/cx2341x/README.hm 'S561' Compressed GBRG Bayer format used by the gspca driver. + + V4L2_PIX_FMT_SGRBG10DPCM8 + 'DB10' + 10 bit raw Bayer DPCM compressed to 8 bits. + V4L2_PIX_FMT_PAC207 'P207' diff --git a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-crop.dia b/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-crop.dia deleted file mode 100644 index e32ba5362e1d..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-crop.dia +++ /dev/null @@ -1,614 +0,0 @@ - - - - - - - - - - - - - #A4# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #sink -crop -selection# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #sink media -bus format# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #source media -bus format# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #pad 1 (source)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #pad 0 (sink)# - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-crop.svg b/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-crop.svg deleted file mode 100644 index 18b0f5de9ed2..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-crop.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - sink - crop - selection - - - - - - sink media - bus format - - - source media - bus format - - - - - - - - - - - - - - - - - - - - - pad 1 (source) - - - - - - - - - - - - - pad 0 (sink) - - diff --git a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-full.dia b/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-full.dia deleted file mode 100644 index a0d782927840..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-full.dia +++ /dev/null @@ -1,1588 +0,0 @@ - - - - - - - - - - - - - #A4# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #pad 0 (sink)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #pad 2 (source)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #sink media -bus format# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #sink compose -selection (scaling)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #source media -bus format# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #sink compose -bounds selection# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #pad 1 (sink)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #pad 3 (source)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #sink -crop -selection# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #source -crop -selection# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-full.svg b/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-full.svg deleted file mode 100644 index 3322cf4c0093..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-full.svg +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - pad 0 (sink) - - - pad 2 (source) - - - - - - - - - - - - - - sink media - bus format - - - - - - - - - - - sink compose - selection (scaling) - - - - - - - source media - bus format - - - - - - - - - - - sink compose - bounds selection - - - - - - - - - - - - - pad 1 (sink) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - pad 3 (source) - - - sink - crop - selection - - - source - crop - selection - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-scaling-multi-source.dia b/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-scaling-multi-source.dia deleted file mode 100644 index 0cd50a7bda80..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-scaling-multi-source.dia +++ /dev/null @@ -1,1152 +0,0 @@ - - - - - - - - - - - - - #A4# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #sink -crop -selection# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #sink media -bus format# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #sink compose -selection (scaling)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #source -crop -selection# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #source media -bus format# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #pad 1 (source)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #pad 0 (sink)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #pad 2 (source)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-scaling-multi-source.svg b/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-scaling-multi-source.svg deleted file mode 100644 index 2340c0f8bc92..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/subdev-image-processing-scaling-multi-source.svg +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - sink - crop - selection - - - - - - sink media - bus format - - - - - - - - - - - sink compose - selection (scaling) - - - - - - - source - crop - selection - - - source media - bus format - - - - - - - - - - - - - - - - - - - - - pad 1 (source) - - - - - - - - - - - - - pad 0 (sink) - - - - - - - - - - - - - - - - - - - - - - pad 2 (source) - - - - - - - - - - - - diff --git a/trunk/Documentation/DocBook/media/v4l/v4l2.xml b/trunk/Documentation/DocBook/media/v4l/v4l2.xml index 015c561754b7..8ae38876172e 100644 --- a/trunk/Documentation/DocBook/media/v4l/v4l2.xml +++ b/trunk/Documentation/DocBook/media/v4l/v4l2.xml @@ -28,8 +28,8 @@ documentation. Hans Verkuil Designed and documented the VIDIOC_LOG_STATUS ioctl, -the extended control ioctls, major parts of the sliced VBI API, the -MPEG encoder and decoder APIs and the DV Timings API. +the extended control ioctls and major parts of the sliced VBI +API.
hverkuil@xs4all.nl @@ -96,17 +96,6 @@ Remote Controller chapter.
- - - Sakari - Ailus - Subdev selections API. - -
- sakari.ailus@iki.fi -
-
-
@@ -123,7 +112,6 @@ Remote Controller chapter. 2009 2010 2011 - 2012 Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab, Pawel Osciak @@ -139,28 +127,6 @@ structs, ioctls) must be noted in more detail in the history chapter (compat.xml), along with the possible impact on existing drivers and applications. --> - - 3.5 - 2012-05-07 - sa, sn - Added V4L2_CTRL_TYPE_INTEGER_MENU and V4L2 subdev - selections API. Improved the description of V4L2_CID_COLORFX - control, added V4L2_CID_COLORFX_CBCR control. - Added camera controls V4L2_CID_AUTO_EXPOSURE_BIAS, - V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, V4L2_CID_IMAGE_STABILIZATION, - V4L2_CID_ISO_SENSITIVITY, V4L2_CID_ISO_SENSITIVITY_AUTO, - V4L2_CID_EXPOSURE_METERING, V4L2_CID_SCENE_MODE, - V4L2_CID_3A_LOCK, V4L2_CID_AUTO_FOCUS_START, - V4L2_CID_AUTO_FOCUS_STOP, V4L2_CID_AUTO_FOCUS_STATUS - and V4L2_CID_AUTO_FOCUS_RANGE. - - 2012-05-01 - hv - Added VIDIOC_ENUM_DV_TIMINGS, VIDIOC_QUERY_DV_TIMINGS and - VIDIOC_DV_TIMINGS_CAP. - - - 3.4 2012-01-25 @@ -467,7 +433,7 @@ and discussions on the V4L mailing list. Video for Linux Two API Specification - Revision 3.5 + Revision 3.3 &sub-common; @@ -525,12 +491,10 @@ and discussions on the V4L mailing list. &sub-dbg-g-register; &sub-decoder-cmd; &sub-dqevent; - &sub-dv-timings-cap; &sub-encoder-cmd; &sub-enumaudio; &sub-enumaudioout; &sub-enum-dv-presets; - &sub-enum-dv-timings; &sub-enum-fmt; &sub-enum-framesizes; &sub-enum-frameintervals; @@ -565,7 +529,6 @@ and discussions on the V4L mailing list. &sub-querycap; &sub-queryctrl; &sub-query-dv-preset; - &sub-query-dv-timings; &sub-querystd; &sub-prepare-buf; &sub-reqbufs; @@ -577,7 +540,6 @@ and discussions on the V4L mailing list. &sub-subdev-g-crop; &sub-subdev-g-fmt; &sub-subdev-g-frame-interval; - &sub-subdev-g-selection; &sub-subscribe-event; &sub-mmap; diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml index 765549ff8a71..73ae8a6cd004 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-create-bufs.xml @@ -48,12 +48,6 @@ Description - - Experimental - This is an experimental - interface and may change in the future. - - This ioctl is used to create buffers for memory mapped or user pointer I/O. It can be used as an alternative or in addition to the @@ -100,18 +94,16 @@ information. The number of buffers requested or granted.
- __u32 + &v4l2-memory; memory Applications set this field to V4L2_MEMORY_MMAP or -V4L2_MEMORY_USERPTR. See +V4L2_MEMORY_USERPTR. - __u32 + &v4l2-format; format - Filled in by the application, preserved by the driver. - See . + Filled in by the application, preserved by the driver. __u32 diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-cropcap.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-cropcap.xml index f1bac2c6e978..b4f2f255211e 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-cropcap.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-cropcap.xml @@ -65,7 +65,7 @@ output. &cs-str; - __u32 + &v4l2-buf-type; type Type of the data stream, set by the application. Only these types are valid here: @@ -73,7 +73,7 @@ Only these types are valid here: V4L2_BUF_TYPE_VIDEO_OUTPUT, V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver defined) types with code V4L2_BUF_TYPE_PRIVATE -and higher. See . +and higher. struct v4l2_rect diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml deleted file mode 100644 index 6673ce582050..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - ioctl VIDIOC_DV_TIMINGS_CAP - &manvol; - - - - VIDIOC_DV_TIMINGS_CAP - The capabilities of the Digital Video receiver/transmitter - - - - - - int ioctl - int fd - int request - struct v4l2_dv_timings_cap *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_DV_TIMINGS_CAP - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - To query the available timings, applications initialize the -index field and zero the reserved array of &v4l2-dv-timings-cap; -and call the VIDIOC_DV_TIMINGS_CAP ioctl with a pointer to this -structure. Drivers fill the rest of the structure or return an -&EINVAL; when the index is out of bounds. To enumerate all supported DV timings, -applications shall begin at index zero, incrementing by one until the -driver returns EINVAL. Note that drivers may enumerate a -different set of DV timings after switching the video input or -output. - - - struct <structname>v4l2_bt_timings_cap</structname> - - &cs-str; - - - __u32 - min_width - Minimum width of the active video in pixels. - - - __u32 - max_width - Maximum width of the active video in pixels. - - - __u32 - min_height - Minimum height of the active video in lines. - - - __u32 - max_height - Maximum height of the active video in lines. - - - __u64 - min_pixelclock - Minimum pixelclock frequency in Hz. - - - __u64 - max_pixelclock - Maximum pixelclock frequency in Hz. - - - __u32 - standards - The video standard(s) supported by the hardware. - See for a list of standards. - - - __u32 - capabilities - Several flags giving more information about the capabilities. - See for a description of the flags. - - - - __u32 - reserved[16] - - - - -
- - - struct <structname>v4l2_dv_timings_cap</structname> - - &cs-str; - - - __u32 - type - Type of DV timings as listed in . - - - __u32 - reserved[3] - Reserved for future extensions. Drivers must set the array to zero. - - - union - - - - - - &v4l2-bt-timings-cap; - bt - BT.656/1120 timings capabilities of the hardware. - - - - __u32 - raw_data[32] - - - - -
- - - DV BT Timing capabilities - - &cs-str; - - - Flag - Description - - - - - - - V4L2_DV_BT_CAP_INTERLACED - Interlaced formats are supported. - - - - V4L2_DV_BT_CAP_PROGRESSIVE - Progressive formats are supported. - - - - V4L2_DV_BT_CAP_REDUCED_BLANKING - CVT/GTF specific: the timings can make use of reduced blanking (CVT) -or the 'Secondary GTF' curve (GTF). - - - - V4L2_DV_BT_CAP_CUSTOM - Can support non-standard timings, i.e. timings not belonging to the -standards set in the standards field. - - - - -
-
- - - &return-value; - -
- - diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml index 509f0012d2a6..0be17c232d3a 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-enum-dv-presets.xml @@ -48,10 +48,6 @@ Description - This ioctl is deprecated. - New drivers and applications should use &VIDIOC-ENUM-DV-TIMINGS; instead. - - To query the attributes of a DV preset, applications initialize the index field and zero the reserved array of &v4l2-dv-enum-preset; and call the VIDIOC_ENUM_DV_PRESETS ioctl with a pointer to this diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml deleted file mode 100644 index 24c3bf4fd29a..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - ioctl VIDIOC_ENUM_DV_TIMINGS - &manvol; - - - - VIDIOC_ENUM_DV_TIMINGS - Enumerate supported Digital Video timings - - - - - - int ioctl - int fd - int request - struct v4l2_enum_dv_timings *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_ENUM_DV_TIMINGS - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - While some DV receivers or transmitters support a wide range of timings, others -support only a limited number of timings. With this ioctl applications can enumerate a list -of known supported timings. Call &VIDIOC-DV-TIMINGS-CAP; to check if it also supports other -standards or even custom timings that are not in this list. - - To query the available timings, applications initialize the -index field and zero the reserved array of &v4l2-enum-dv-timings; -and call the VIDIOC_ENUM_DV_TIMINGS ioctl with a pointer to this -structure. Drivers fill the rest of the structure or return an -&EINVAL; when the index is out of bounds. To enumerate all supported DV timings, -applications shall begin at index zero, incrementing by one until the -driver returns EINVAL. Note that drivers may enumerate a -different set of DV timings after switching the video input or -output. - - - struct <structname>v4l2_enum_dv_timings</structname> - - &cs-str; - - - __u32 - index - Number of the DV timings, set by the -application. - - - __u32 - reserved[3] - Reserved for future extensions. Drivers must set the array to zero. - - - &v4l2-dv-timings; - timings - The timings. - - - -
-
- - - &return-value; - - - - EINVAL - - The &v4l2-enum-dv-timings; index -is out of bounds. - - - - -
- - diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml index 81ebe48317fe..347d142e7431 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml @@ -71,7 +71,7 @@ the application. This is in no way related to the pixelformat field.
- __u32 + &v4l2-buf-type; type Type of the data stream, set by the application. Only these types are valid here: @@ -81,7 +81,7 @@ Only these types are valid here: V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver defined) types with code V4L2_BUF_TYPE_PRIVATE -and higher. See . +and higher. __u32 diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-enuminput.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-enuminput.xml index 46d5a044a537..9b8efcd6e947 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-enuminput.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-enuminput.xml @@ -285,7 +285,7 @@ input/output interface to linux-media@vger.kernel.org on 19 Oct 2009. V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 - This input supports setting video timings by using VIDIOC_S_DV_TIMINGS. + This input supports setting custom video timings by using VIDIOC_S_DV_TIMINGS. V4L2_IN_CAP_STD diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml index 428020000ef0..a64d5ef103fa 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml @@ -170,7 +170,7 @@ input/output interface to linux-media@vger.kernel.org on 19 Oct 2009. V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 - This output supports setting video timings by using VIDIOC_S_DV_TIMINGS. + This output supports setting custom video timings by using VIDIOC_S_DV_TIMINGS. V4L2_OUT_CAP_STD diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-g-crop.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-g-crop.xml index c4ff3b1887fb..01a50640dce0 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-g-crop.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-g-crop.xml @@ -100,14 +100,14 @@ changed and VIDIOC_S_CROP returns the &cs-str; - __u32 + &v4l2-buf-type; type Type of the data stream, set by the application. Only these types are valid here: V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_OUTPUT, V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver defined) types with code V4L2_BUF_TYPE_PRIVATE -and higher. See . +and higher. &v4l2-rect; diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml index 61be9fa3803a..7940c1149393 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml @@ -48,12 +48,6 @@ Description - - These ioctls are deprecated. - New drivers and applications should use &VIDIOC-G-DV-TIMINGS; and &VIDIOC-S-DV-TIMINGS; - instead. - - To query and select the current DV preset, applications use the VIDIOC_G_DV_PRESET and VIDIOC_S_DV_PRESET ioctls which take a pointer to a &v4l2-dv-preset; type as argument. diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml index eda1a2991bbe..4a8648ae9a63 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml @@ -7,7 +7,7 @@ VIDIOC_G_DV_TIMINGS VIDIOC_S_DV_TIMINGS - Get or set DV timings for input or output + Get or set custom DV timings for input or output @@ -48,15 +48,12 @@ Description - To set DV timings for the input or output, applications use the -VIDIOC_S_DV_TIMINGS ioctl and to get the current timings, + To set custom DV timings for the input or output, applications use the +VIDIOC_S_DV_TIMINGS ioctl and to get the current custom timings, applications use the VIDIOC_G_DV_TIMINGS ioctl. The detailed timing information is filled in using the structure &v4l2-dv-timings;. These ioctls take a pointer to the &v4l2-dv-timings; structure as argument. If the ioctl is not supported or the timing values are not correct, the driver returns &EINVAL;. -The linux/v4l2-dv-timings.h header can be used to get the -timings of the formats in the and -standards. @@ -86,13 +83,12 @@ standards. __u32 width - Width of the active video in pixels. + Width of the active video in pixels __u32 height - Height of the active video frame in lines. So for interlaced formats the - height of the active video in each field is height/2. + Height of the active video in lines __u32 @@ -129,52 +125,32 @@ bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_H __u32 vfrontporch - Vertical front porch in lines. For interlaced formats this refers to the - odd field (aka field 1). + Vertical front porch in lines __u32 vsync - Vertical sync length in lines. For interlaced formats this refers to the - odd field (aka field 1). + Vertical sync length in lines __u32 vbackporch - Vertical back porch in lines. For interlaced formats this refers to the - odd field (aka field 1). + Vertical back porch in lines __u32 il_vfrontporch - Vertical front porch in lines for the even field (aka field 2) of - interlaced field formats. + Vertical front porch in lines for bottom field of interlaced field formats __u32 il_vsync - Vertical sync length in lines for the even field (aka field 2) of - interlaced field formats. + Vertical sync length in lines for bottom field of interlaced field formats __u32 il_vbackporch - Vertical back porch in lines for the even field (aka field 2) of - interlaced field formats. - - - __u32 - standards - The video standard(s) this format belongs to. This will be filled in by - the driver. Applications must set this to 0. See - for a list of standards. - - - __u32 - flags - Several flags giving more information about the format. - See for a description of the flags. - + Vertical back porch in lines for bottom field of interlaced field formats @@ -235,90 +211,6 @@ bit 0 (V4L2_DV_VSYNC_POS_POL) is for vertical sync polarity and bit 1 (V4L2_DV_H - - DV BT Timing standards - - &cs-str; - - - Timing standard - Description - - - - - - - V4L2_DV_BT_STD_CEA861 - The timings follow the CEA-861 Digital TV Profile standard - - - V4L2_DV_BT_STD_DMT - The timings follow the VESA Discrete Monitor Timings standard - - - V4L2_DV_BT_STD_CVT - The timings follow the VESA Coordinated Video Timings standard - - - V4L2_DV_BT_STD_GTF - The timings follow the VESA Generalized Timings Formula standard - - - -
- - DV BT Timing flags - - &cs-str; - - - Flag - Description - - - - - - - V4L2_DV_FL_REDUCED_BLANKING - CVT/GTF specific: the timings use reduced blanking (CVT) or the 'Secondary -GTF' curve (GTF). In both cases the horizontal and/or vertical blanking -intervals are reduced, allowing a higher resolution over the same -bandwidth. This is a read-only flag, applications must not set this. - - - - V4L2_DV_FL_CAN_REDUCE_FPS - CEA-861 specific: set for CEA-861 formats with a framerate that is a multiple -of six. These formats can be optionally played at 1 / 1.001 speed to -be compatible with 60 Hz based standards such as NTSC and PAL-M that use a framerate of -29.97 frames per second. If the transmitter can't generate such frequencies, then the -flag will also be cleared. This is a read-only flag, applications must not set this. - - - - V4L2_DV_FL_REDUCED_FPS - CEA-861 specific: only valid for video transmitters, the flag is cleared -by receivers. It is also only valid for formats with the V4L2_DV_FL_CAN_REDUCE_FPS flag -set, for other formats the flag will be cleared by the driver. - -If the application sets this flag, then the pixelclock used to set up the transmitter is -divided by 1.001 to make it compatible with NTSC framerates. If the transmitter -can't generate such frequencies, then the flag will also be cleared. - - - - V4L2_DV_FL_HALF_LINE - Specific to interlaced formats: if set, then field 1 (aka the odd field) -is really one half-line longer and field 2 (aka the even field) is really one half-line -shorter, so each field has exactly the same number of half-lines. Whether half-lines can be -detected or used depends on the hardware. - - - - -
&return-value; diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml index e3d5afcdafbb..b17a7aac6997 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml @@ -265,32 +265,6 @@ These controls are described in .
- - V4L2_CTRL_CLASS_JPEG - 0x9d0000 - The class containing JPEG compression controls. -These controls are described in . - - - V4L2_CTRL_CLASS_IMAGE_SOURCE - 0x9e0000 The class containing image - source controls. These controls are described in . - - - V4L2_CTRL_CLASS_IMAGE_PROC - 0x9f0000 The class containing image - processing controls. These controls are described in . - - - V4L2_CTRL_CLASS_JPEG - 0x9d0000 - The class containing JPEG compression controls. -These controls are described in . - diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml index 52acff193a6f..17fbda15137b 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml @@ -116,7 +116,7 @@ this ioctl. - __u32 + &v4l2-buf-type; type Type of the data stream, see modulator field and the &v4l2-modulator; index field. - __u32 + &v4l2-tuner-type; type The tuner type. This is the same value as in the -&v4l2-tuner; type field. See The type must be set +&v4l2-tuner; type field. The type must be set to V4L2_TUNER_RADIO for /dev/radioX device nodes, and to V4L2_TUNER_ANALOG_TV for all others. The field is not applicable to modulators, &ie; ignored -by drivers. See +by drivers. __u32 diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-g-parm.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-g-parm.xml index f83d2cdd1185..19b1d85dd668 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-g-parm.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-g-parm.xml @@ -75,12 +75,11 @@ devices. &cs-ustr; - __u32 + &v4l2-buf-type; type The buffer (stream) type, same as &v4l2-format; -type, set by the application. See +type, set by the application. union diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml index bd015d1563ff..71741daaf725 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-g-sliced-vbi-cap.xml @@ -148,7 +148,7 @@ using the &VIDIOC-S-FMT; ioctl as described in service_lines[1][0] to zero. - __u32 + &v4l2-buf-type; type Type of the data stream, see . Should be diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml index 62a1aa200a36..91ec2fb658f8 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml @@ -107,7 +107,7 @@ user. - __u32 + &v4l2-tuner-type; type Type of the tuner, see . diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-prepare-buf.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-prepare-buf.xml index fa7ad7e33228..7bde698760e4 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-prepare-buf.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-prepare-buf.xml @@ -48,12 +48,6 @@ Description - - Experimental - This is an experimental - interface and may change in the future. - - Applications can optionally call the VIDIOC_PREPARE_BUF ioctl to pass ownership of the buffer to the driver before actually enqueuing it, using the diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml index 1bc8aeb3ff1f..23b17f604211 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml @@ -49,10 +49,6 @@ input Description - This ioctl is deprecated. - New drivers and applications should use &VIDIOC-QUERY-DV-TIMINGS; instead. - - The hardware may be able to detect the current DV preset automatically, similar to sensing the video standard. To do so, applications call VIDIOC_QUERY_DV_PRESET with a pointer to a diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml deleted file mode 100644 index 44935a0ffcf0..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - ioctl VIDIOC_QUERY_DV_TIMINGS - &manvol; - - - - VIDIOC_QUERY_DV_TIMINGS - Sense the DV preset received by the current -input - - - - - - int ioctl - int fd - int request - struct v4l2_dv_timings *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_QUERY_DV_TIMINGS - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - The hardware may be able to detect the current DV timings -automatically, similar to sensing the video standard. To do so, applications -call VIDIOC_QUERY_DV_TIMINGS with a pointer to a -&v4l2-dv-timings;. Once the hardware detects the timings, it will fill in the -timings structure. - -If the timings could not be detected because there was no signal, then -ENOLINK is returned. If a signal was detected, but -it was unstable and the receiver could not lock to the signal, then -ENOLCK is returned. If the receiver could lock to the signal, -but the format is unsupported (e.g. because the pixelclock is out of range -of the hardware capabilities), then the driver fills in whatever timings it -could find and returns ERANGE. In that case the application -can call &VIDIOC-DV-TIMINGS-CAP; to compare the found timings with the hardware's -capabilities in order to give more precise feedback to the user. - - - - - &return-value; - - - - ENOLINK - - No timings could be detected because no signal was found. - - - - - ENOLCK - - The signal was unstable and the hardware could not lock on to it. - - - - - ERANGE - - Timings were found, but they are out of range of the hardware -capabilities. - - - - - - diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml index e6645b996558..36660d311b51 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml @@ -127,7 +127,7 @@ the first control with a higher ID. Drivers which do not support this flag yet always return an &EINVAL;. - __u32 + &v4l2-ctrl-type; type Type of control, see . @@ -215,12 +215,11 @@ the array to zero. struct <structname>v4l2_querymenu</structname> - + &cs-str; __u32 - id Identifies the control, set by the application from the respective &v4l2-queryctrl; @@ -228,38 +227,18 @@ from the respective &v4l2-queryctrl; __u32 - index Index of the menu item, starting at zero, set by the application. - union - - - - - - __u8 name[32] Name of the menu item, a NUL-terminated ASCII -string. This information is intended for the user. This field is valid -for V4L2_CTRL_FLAG_MENU type controls. - - - - __s64 - value - - Value of the integer menu item. This field is valid for - V4L2_CTRL_FLAG_INTEGER_MENU type - controls. - +string. This information is intended for the user. __u32 - reserved Reserved for future extensions. Drivers must set the array to zero. @@ -312,20 +291,6 @@ values which are actually different on the hardware. the menu items can be enumerated with the VIDIOC_QUERYMENU ioctl. - - V4L2_CTRL_TYPE_INTEGER_MENU - ≥ 0 - 1 - N-1 - - The control has a menu of N choices. The values of the - menu items can be enumerated with the - VIDIOC_QUERYMENU ioctl. This is - similar to V4L2_CTRL_TYPE_MENU - except that instead of strings, the menu items are - signed 64-bit integers. - - V4L2_CTRL_TYPE_BITMASK 0 diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml index d7c95057bc51..7be4b1d29b90 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-reqbufs.xml @@ -92,19 +92,18 @@ streamoff.--> The number of buffers requested or granted. - __u32 + &v4l2-buf-type; type Type of the stream or buffers, this is the same as the &v4l2-format; type field. See for valid values. - __u32 + &v4l2-memory; memory Applications set this field to V4L2_MEMORY_MMAP or -V4L2_MEMORY_USERPTR. See . +V4L2_MEMORY_USERPTR. __u32 diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml index 407dfceb71f0..18b1a8266f7c 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml @@ -73,11 +73,10 @@ same value as in the &v4l2-input; tuner field and the &v4l2-tuner; index field. - __u32 + &v4l2-tuner-type; type The tuner type. This is the same value as in the -&v4l2-tuner; type field. See +&v4l2-tuner; type field. __u32 diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml index 4cddd788c589..06197323a8cc 100644 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml +++ b/trunk/Documentation/DocBook/media/v4l/vidioc-subdev-g-crop.xml @@ -58,12 +58,9 @@ Description - Obsolete - - This is an obsolete - interface and may be removed in the future. It is superseded by - the selection - API. + Experimental + This is an experimental + interface and may change in the future. To retrieve the current crop rectangle applications set the diff --git a/trunk/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml b/trunk/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml deleted file mode 100644 index 208e9f0da3f3..000000000000 --- a/trunk/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - ioctl VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION - &manvol; - - - - VIDIOC_SUBDEV_G_SELECTION - VIDIOC_SUBDEV_S_SELECTION - Get or set selection rectangles on a subdev pad - - - - - - int ioctl - int fd - int request - struct v4l2_subdev_selection *argp - - - - - - Arguments - - - - fd - - &fd; - - - - request - - VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION - - - - argp - - - - - - - - - Description - - - Experimental - This is an experimental - interface and may change in the future. - - - The selections are used to configure various image - processing functionality performed by the subdevs which affect the - image size. This currently includes cropping, scaling and - composition. - - The selection API replaces the old subdev crop API. All - the function of the crop API, and more, are supported by the - selections API. - - See for - more information on how each selection target affects the image - processing pipeline inside the subdevice. - -
- Types of selection targets - - There are two types of selection targets: actual and bounds. - The ACTUAL targets are the targets which configure the hardware. - The BOUNDS target will return a rectangle that contain all - possible ACTUAL rectangles. -
- -
- Discovering supported features - - To discover which targets are supported, the user can - perform VIDIOC_SUBDEV_G_SELECTION on them. - Any unsupported target will return - EINVAL. -
- -
- V4L2 subdev selection targets - - &cs-def; - - - V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL - 0x0000 - Actual crop. Defines the cropping - performed by the processing step. - - - V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS - 0x0002 - Bounds of the crop rectangle. - - - V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL - 0x0100 - Actual compose rectangle. Used to configure scaling - on sink pads and composition on source pads. - - - V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS - 0x0102 - Bounds of the compose rectangle. - - - -
- - - V4L2 subdev selection flags - - &cs-def; - - - V4L2_SUBDEV_SEL_FLAG_SIZE_GE - (1 << 0) Suggest the driver it - should choose greater or equal rectangle (in size) than - was requested. Albeit the driver may choose a lesser size, - it will only do so due to hardware limitations. Without - this flag (and - V4L2_SUBDEV_SEL_FLAG_SIZE_LE) the - behaviour is to choose the closest possible - rectangle. - - - V4L2_SUBDEV_SEL_FLAG_SIZE_LE - (1 << 1) Suggest the driver it - should choose lesser or equal rectangle (in size) than was - requested. Albeit the driver may choose a greater size, it - will only do so due to hardware limitations. - - - V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG - (1 << 2) - The configuration should not be propagated to any - further processing steps. If this flag is not given, the - configuration is propagated inside the subdevice to all - further processing steps. - - - -
- - - struct <structname>v4l2_subdev_selection</structname> - - &cs-str; - - - __u32 - which - Active or try selection, from - &v4l2-subdev-format-whence;. - - - __u32 - pad - Pad number as reported by the media framework. - - - __u32 - target - Target selection rectangle. See - .. - - - __u32 - flags - Flags. See - . - - - &v4l2-rect; - rect - Selection rectangle, in pixels. - - - __u32 - reserved[8] - Reserved for future extensions. Applications and drivers must - set the array to zero. - - - -
- - - - - &return-value; - - - - EBUSY - - The selection rectangle can't be changed because the - pad is currently busy. This can be caused, for instance, by - an active video stream on the pad. The ioctl must not be - retried without performing another action to fix the problem - first. Only returned by - VIDIOC_SUBDEV_S_SELECTION - - - - EINVAL - - The &v4l2-subdev-selection; - pad references a non-existing - pad, the which field references a - non-existing format, or the selection target is not - supported on the given subdev pad. - - - - - diff --git a/trunk/Documentation/devicetree/bindings/input/spear-keyboard.txt b/trunk/Documentation/devicetree/bindings/input/spear-keyboard.txt deleted file mode 100644 index 4a846d26da23..000000000000 --- a/trunk/Documentation/devicetree/bindings/input/spear-keyboard.txt +++ /dev/null @@ -1,20 +0,0 @@ -* SPEAr keyboard controller - -Required properties: -- compatible: "st,spear300-kbd" - -Optional properties, in addition to those specified by the shared -matrix-keyboard bindings: -- autorepeat: bool: enables key autorepeat -- st,mode: keyboard mode: 0 - 9x9, 1 - 6x6, 2 - 2x2 - -Example: - -kbd@fc400000 { - compatible = "st,spear300-kbd"; - reg = <0xfc400000 0x100>; - linux,keymap = < 0x00030012 - 0x0102003a >; - autorepeat; - st,mode = <0>; -}; diff --git a/trunk/Documentation/devicetree/bindings/input/touchscreen/lpc32xx-tsc.txt b/trunk/Documentation/devicetree/bindings/input/touchscreen/lpc32xx-tsc.txt deleted file mode 100644 index 41cbf4b7a670..000000000000 --- a/trunk/Documentation/devicetree/bindings/input/touchscreen/lpc32xx-tsc.txt +++ /dev/null @@ -1,16 +0,0 @@ -* NXP LPC32xx SoC Touchscreen Controller (TSC) - -Required properties: -- compatible: must be "nxp,lpc3220-tsc" -- reg: physical base address of the controller and length of memory mapped - region. -- interrupts: The TSC/ADC interrupt - -Example: - - tsc@40048000 { - compatible = "nxp,lpc3220-tsc"; - reg = <0x40048000 0x1000>; - interrupt-parent = <&mic>; - interrupts = <39 0>; - }; diff --git a/trunk/Documentation/devicetree/bindings/input/twl6040-vibra.txt b/trunk/Documentation/devicetree/bindings/input/twl6040-vibra.txt deleted file mode 100644 index 5b1918b818fb..000000000000 --- a/trunk/Documentation/devicetree/bindings/input/twl6040-vibra.txt +++ /dev/null @@ -1,37 +0,0 @@ -Vibra driver for the twl6040 family - -The vibra driver is a child of the twl6040 MFD dirver. -Documentation/devicetree/bindings/mfd/twl6040.txt - -Required properties: -- compatible : Must be "ti,twl6040-vibra"; -- interrupts: 4, Vibra overcurrent interrupt -- vddvibl-supply: Regulator supplying the left vibra motor -- vddvibr-supply: Regulator supplying the right vibra motor -- vibldrv_res: Board specific left driver resistance -- vibrdrv_res: Board specific right driver resistance -- viblmotor_res: Board specific left motor resistance -- vibrmotor_res: Board specific right motor resistance - -Optional properties: -- vddvibl_uV: If the vddvibl default voltage need to be changed -- vddvibr_uV: If the vddvibr default voltage need to be changed - -Example: -/* - * 8-channel high quality low-power audio codec - * http://www.ti.com/lit/ds/symlink/twl6040.pdf - */ -twl6040: twl6040@4b { - ... - twl6040_vibra: twl6040@1 { - compatible = "ti,twl6040-vibra"; - interrupts = <4>; - vddvibl-supply = <&vbat>; - vddvibr-supply = <&vbat>; - vibldrv_res = <8>; - vibrdrv_res = <3>; - viblmotor_res = <10>; - vibrmotor_res = <10>; - }; -}; diff --git a/trunk/Documentation/dvb/get_dvb_firmware b/trunk/Documentation/dvb/get_dvb_firmware index fbb241174486..d1d4a179a382 100755 --- a/trunk/Documentation/dvb/get_dvb_firmware +++ b/trunk/Documentation/dvb/get_dvb_firmware @@ -28,8 +28,7 @@ use IO::Handle; "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2", "mpc718", "af9015", "ngene", "az6027", "lme2510_lg", "lme2510c_s7395", "lme2510c_s7395_old", "drxk", "drxk_terratec_h5", - "drxk_hauppauge_hvr930c", "tda10071", "it9135", "it9137", - "drxk_pctv"); + "drxk_hauppauge_hvr930c", "tda10071", "it9135", "it9137"); # Check args syntax() if (scalar(@ARGV) != 1); @@ -731,23 +730,6 @@ sub tda10071 { "$fwfile"; } -sub drxk_pctv { - my $sourcefile = "PCTV_460e_reference.zip"; - my $url = "ftp://ftp.pctvsystems.com/TV/driver/PCTV%2070e%2080e%20100e%20320e%20330e%20800e/"; - my $hash = "4403de903bf2593464c8d74bbc200a57"; - my $fwfile = "dvb-demod-drxk-pctv.fw"; - my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); - - checkstandard(); - - wgetfile($sourcefile, $url . $sourcefile); - verify($sourcefile, $hash); - unzip($sourcefile, $tmpdir); - extract("$tmpdir/PCTV\ 70e\ 80e\ 100e\ 320e\ 330e\ 800e/32\ bit/emOEM.sys", 0x72b80, 42692, $fwfile); - - "$fwfile"; -} - # --------------------------------------------------------------- # Utilities diff --git a/trunk/Documentation/feature-removal-schedule.txt b/trunk/Documentation/feature-removal-schedule.txt index 50d82ae09e2a..1e69a81e99d4 100644 --- a/trunk/Documentation/feature-removal-schedule.txt +++ b/trunk/Documentation/feature-removal-schedule.txt @@ -541,18 +541,6 @@ Who: Kees Cook ---------------------------- -What: Removing the pn544 raw driver. -When: 3.6 -Why: With the introduction of the NFC HCI and SHDL kernel layers, pn544.c - is being replaced by pn544_hci.c which is accessible through the netlink - and socket NFC APIs. Moreover, pn544.c is outdated and does not seem to - work properly with the latest Android stacks. - Having 2 drivers for the same hardware is confusing and as such we - should only keep the one following the kernel NFC APIs. -Who: Samuel Ortiz - ----------------------------- - What: setitimer accepts user NULL pointer (value) When: 3.6 Why: setitimer is not returning -EFAULT if user pointer is NULL. This @@ -561,15 +549,6 @@ Who: Sasikantha Babu ---------------------------- -What: remove bogus DV presets V4L2_DV_1080I29_97, V4L2_DV_1080I30 and - V4L2_DV_1080I25 -When: 3.6 -Why: These HDTV formats do not exist and were added by a confused mind - (that was me, to be precise...) -Who: Hans Verkuil - ----------------------------- - What: V4L2_CID_HCENTER, V4L2_CID_VCENTER V4L2 controls When: 3.7 Why: The V4L2_CID_VCENTER, V4L2_CID_HCENTER controls have been deprecated diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index b69cfdc12112..5b6e58492229 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -987,20 +987,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted. i8k.restricted [HW] Allow controlling fans only if SYS_ADMIN capability is set. - i915.invert_brightness= - [DRM] Invert the sense of the variable that is used to - set the brightness of the panel backlight. Normally a - brightness value of 0 indicates backlight switched off, - and the maximum of the brightness value sets the backlight - to maximum brightness. If this parameter is set to 0 - (default) and the machine requires it, or this parameter - is set to 1, a brightness value of 0 sets the backlight - to maximum brightness, and the maximum of the brightness - value switches the backlight off. - -1 -- never invert brightness - 0 -- machine default - 1 -- force brightness inversion - icn= [HW,ISDN] Format: [,[,[,]]] diff --git a/trunk/Documentation/media-framework.txt b/trunk/Documentation/media-framework.txt index 802875413873..3a0f879533ce 100644 --- a/trunk/Documentation/media-framework.txt +++ b/trunk/Documentation/media-framework.txt @@ -335,9 +335,6 @@ the media_entity pipe field. Calls to media_entity_pipeline_start() can be nested. The pipeline pointer must be identical for all nested calls to the function. -media_entity_pipeline_start() may return an error. In that case, it will -clean up any the changes it did by itself. - When stopping the stream, drivers must notify the entities with media_entity_pipeline_stop(struct media_entity *entity); @@ -354,19 +351,3 @@ If other operations need to be disallowed on streaming entities (such as changing entities configuration parameters) drivers can explicitly check the media_entity stream_count field to find out if an entity is streaming. This operation must be done with the media_device graph_mutex held. - - -Link validation ---------------- - -Link validation is performed by media_entity_pipeline_start() for any -entity which has sink pads in the pipeline. The -media_entity::link_validate() callback is used for that purpose. In -link_validate() callback, entity driver should check that the properties of -the source pad of the connected entity and its own sink pad match. It is up -to the type of the entity (and in the end, the properties of the hardware) -what matching actually means. - -Subsystems should facilitate link validation by providing subsystem specific -helper functions to provide easy access for commonly needed information, and -in the end provide a way to use driver-specific callbacks. diff --git a/trunk/Documentation/nfc/nfc-hci.txt b/trunk/Documentation/nfc/nfc-hci.txt index 320f9336c781..216b7254fcc3 100644 --- a/trunk/Documentation/nfc/nfc-hci.txt +++ b/trunk/Documentation/nfc/nfc-hci.txt @@ -22,9 +22,9 @@ response to arrive. HCI events can also be received from the host controller. They will be handled and a translation will be forwarded to NFC Core as needed. HCI uses 2 execution contexts: -- one for executing commands : nfc_hci_msg_tx_work(). Only one command +- one if for executing commands : nfc_hci_msg_tx_work(). Only one command can be executing at any given moment. -- one for dispatching received events and commands : nfc_hci_msg_rx_work(). +- one if for dispatching received events and responses : nfc_hci_msg_rx_work() HCI Session initialization: --------------------------- @@ -52,42 +52,18 @@ entry points: struct nfc_hci_ops { int (*open)(struct nfc_hci_dev *hdev); void (*close)(struct nfc_hci_dev *hdev); - int (*hci_ready) (struct nfc_hci_dev *hdev); int (*xmit)(struct nfc_hci_dev *hdev, struct sk_buff *skb); int (*start_poll)(struct nfc_hci_dev *hdev, u32 protocols); int (*target_from_gate)(struct nfc_hci_dev *hdev, u8 gate, struct nfc_target *target); - int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate, - struct nfc_target *target); - int (*data_exchange) (struct nfc_hci_dev *hdev, - struct nfc_target *target, - struct sk_buff *skb, struct sk_buff **res_skb); - int (*check_presence)(struct nfc_hci_dev *hdev, - struct nfc_target *target); }; -- open() and close() shall turn the hardware on and off. -- hci_ready() is an optional entry point that is called right after the hci -session has been set up. The driver can use it to do additional initialization -that must be performed using HCI commands. -- xmit() shall simply write a frame to the chip. -- start_poll() is an optional entrypoint that shall set the hardware in polling -mode. This must be implemented only if the hardware uses proprietary gates or a -mechanism slightly different from the HCI standard. -- target_from_gate() is an optional entrypoint to return the nfc protocols +open() and close() shall turn the hardware on and off. xmit() shall simply +write a frame to the chip. start_poll() is an optional entrypoint that shall +set the hardware in polling mode. This must be implemented only if the hardware +uses proprietary gates or a mechanism slightly different from the HCI standard. +target_from_gate() is another optional entrypoint to return the protocols corresponding to a proprietary gate. -- complete_target_discovered() is an optional entry point to let the driver -perform additional proprietary processing necessary to auto activate the -discovered target. -- data_exchange() must be implemented by the driver if proprietary HCI commands -are required to send data to the tag. Some tag types will require custom -commands, others can be written to using the standard HCI commands. The driver -can check the tag type and either do proprietary processing, or return 1 to ask -for standard processing. -- check_presence() is an optional entry point that will be called regularly -by the core to check that an activated tag is still in the field. If this is -not implemented, the core will not be able to push tag_lost events to the user -space On the rx path, the driver is responsible to push incoming HCP frames to HCI using nfc_hci_recv_frame(). HCI will take care of re-aggregation and handling @@ -123,8 +99,7 @@ fast, cannot sleep. stores incoming frames into an shdlc rx queue handles shdlc rx & tx queues. Dispatches HCI cmd responses. - HCI Tx Cmd worker (MSGTXWQ) -Serializes execution of HCI commands. Completes execution in case of response -timeout. +Serialize execution of HCI commands. Complete execution in case of resp timeout. - HCI Rx worker (MSGRXWQ) Dispatches incoming HCI commands or events. @@ -158,11 +133,11 @@ able to complete the command with a timeout error if no response arrive. SMW context gets scheduled and invokes nfc_shdlc_sm_work(). This function handles shdlc framing in and out. It uses the driver xmit to send frames and receives incoming frames in an skb queue filled from the driver IRQ handler. -SHDLC I(nformation) frames payload are HCP fragments. They are aggregated to +SHDLC I(nformation) frames payload are HCP fragments. They are agregated to form complete HCI frames, which can be a response, command, or event. HCI Responses are dispatched immediately from this context to unblock -waiting command execution. Response processing involves invoking the completion +waiting command execution. Reponse processing involves invoking the completion callback that was provided by nfc_hci_msg_tx_work() when it sent the command. The completion callback will then wake the syscall context. diff --git a/trunk/Documentation/trace/uprobetracer.txt b/trunk/Documentation/trace/uprobetracer.txt deleted file mode 100644 index 24ce6823a09e..000000000000 --- a/trunk/Documentation/trace/uprobetracer.txt +++ /dev/null @@ -1,113 +0,0 @@ - Uprobe-tracer: Uprobe-based Event Tracing - ========================================= - Documentation written by Srikar Dronamraju - -Overview --------- -Uprobe based trace events are similar to kprobe based trace events. -To enable this feature, build your kernel with CONFIG_UPROBE_EVENT=y. - -Similar to the kprobe-event tracer, this doesn't need to be activated via -current_tracer. Instead of that, add probe points via -/sys/kernel/debug/tracing/uprobe_events, and enable it via -/sys/kernel/debug/tracing/events/uprobes//enabled. - -However unlike kprobe-event tracer, the uprobe event interface expects the -user to calculate the offset of the probepoint in the object - -Synopsis of uprobe_tracer -------------------------- - p[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] : Set a probe - - GRP : Group name. If omitted, use "uprobes" for it. - EVENT : Event name. If omitted, the event name is generated - based on SYMBOL+offs. - PATH : path to an executable or a library. - SYMBOL[+offs] : Symbol+offset where the probe is inserted. - - FETCHARGS : Arguments. Each probe can have up to 128 args. - %REG : Fetch register REG - -Event Profiling ---------------- - You can check the total number of probe hits and probe miss-hits via -/sys/kernel/debug/tracing/uprobe_profile. - The first column is event name, the second is the number of probe hits, -the third is the number of probe miss-hits. - -Usage examples --------------- -To add a probe as a new event, write a new definition to uprobe_events -as below. - - echo 'p: /bin/bash:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events - - This sets a uprobe at an offset of 0x4245c0 in the executable /bin/bash - - echo > /sys/kernel/debug/tracing/uprobe_events - - This clears all probe points. - -The following example shows how to dump the instruction pointer and %ax -a register at the probed text address. Here we are trying to probe -function zfree in /bin/zsh - - # cd /sys/kernel/debug/tracing/ - # cat /proc/`pgrep zsh`/maps | grep /bin/zsh | grep r-xp - 00400000-0048a000 r-xp 00000000 08:03 130904 /bin/zsh - # objdump -T /bin/zsh | grep -w zfree - 0000000000446420 g DF .text 0000000000000012 Base zfree - -0x46420 is the offset of zfree in object /bin/zsh that is loaded at -0x00400000. Hence the command to probe would be : - - # echo 'p /bin/zsh:0x46420 %ip %ax' > uprobe_events - -Please note: User has to explicitly calculate the offset of the probepoint -in the object. We can see the events that are registered by looking at the -uprobe_events file. - - # cat uprobe_events - p:uprobes/p_zsh_0x46420 /bin/zsh:0x00046420 arg1=%ip arg2=%ax - -The format of events can be seen by viewing the file events/uprobes/p_zsh_0x46420/format - - # cat events/uprobes/p_zsh_0x46420/format - name: p_zsh_0x46420 - ID: 922 - format: - field:unsigned short common_type; offset:0; size:2; signed:0; - field:unsigned char common_flags; offset:2; size:1; signed:0; - field:unsigned char common_preempt_count; offset:3; size:1; signed:0; - field:int common_pid; offset:4; size:4; signed:1; - field:int common_padding; offset:8; size:4; signed:1; - - field:unsigned long __probe_ip; offset:12; size:4; signed:0; - field:u32 arg1; offset:16; size:4; signed:0; - field:u32 arg2; offset:20; size:4; signed:0; - - print fmt: "(%lx) arg1=%lx arg2=%lx", REC->__probe_ip, REC->arg1, REC->arg2 - -Right after definition, each event is disabled by default. For tracing these -events, you need to enable it by: - - # echo 1 > events/uprobes/enable - -Lets disable the event after sleeping for some time. - # sleep 20 - # echo 0 > events/uprobes/enable - -And you can see the traced information via /sys/kernel/debug/tracing/trace. - - # cat trace - # tracer: nop - # - # TASK-PID CPU# TIMESTAMP FUNCTION - # | | | | | - zsh-24842 [006] 258544.995456: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79 - zsh-24842 [007] 258545.000270: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79 - zsh-24842 [002] 258545.043929: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79 - zsh-24842 [004] 258547.046129: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79 - -Each line shows us probes were triggered for a pid 24842 with ip being -0x446421 and contents of ax register being 79. diff --git a/trunk/Documentation/video4linux/4CCs.txt b/trunk/Documentation/video4linux/4CCs.txt deleted file mode 100644 index 41241af1ebfe..000000000000 --- a/trunk/Documentation/video4linux/4CCs.txt +++ /dev/null @@ -1,32 +0,0 @@ -Guidelines for Linux4Linux pixel format 4CCs -============================================ - -Guidelines for Video4Linux 4CC codes defined using v4l2_fourcc() are -specified in this document. First of the characters defines the nature of -the pixel format, compression and colour space. The interpretation of the -other three characters depends on the first one. - -Existing 4CCs may not obey these guidelines. - -Formats -======= - -Raw bayer ---------- - -The following first characters are used by raw bayer formats: - - B: raw bayer, uncompressed - b: raw bayer, DPCM compressed - a: A-law compressed - u: u-law compressed - -2nd character: pixel order - B: BGGR - G: GBRG - g: GRBG - R: RGGB - -3rd character: uncompressed bits-per-pixel 0--9, A-- - -4th character: compressed bits-per-pixel 0--9, A-- diff --git a/trunk/Documentation/video4linux/gspca.txt b/trunk/Documentation/video4linux/gspca.txt index 1e6b6531bbcc..e6c2842407a4 100644 --- a/trunk/Documentation/video4linux/gspca.txt +++ b/trunk/Documentation/video4linux/gspca.txt @@ -276,7 +276,6 @@ pac7302 093a:2622 Genius Eye 312 pac7302 093a:2624 PAC7302 pac7302 093a:2625 Genius iSlim 310 pac7302 093a:2626 Labtec 2200 -pac7302 093a:2627 Genius FaceCam 300 pac7302 093a:2628 Genius iLook 300 pac7302 093a:2629 Genious iSlim 300 pac7302 093a:262a Webcam 300k diff --git a/trunk/Documentation/video4linux/v4l2-controls.txt b/trunk/Documentation/video4linux/v4l2-controls.txt index 43da22b89728..e2492a9d1027 100644 --- a/trunk/Documentation/video4linux/v4l2-controls.txt +++ b/trunk/Documentation/video4linux/v4l2-controls.txt @@ -130,18 +130,8 @@ Menu controls are added by calling v4l2_ctrl_new_std_menu: const struct v4l2_ctrl_ops *ops, u32 id, s32 max, s32 skip_mask, s32 def); -Or alternatively for integer menu controls, by calling v4l2_ctrl_new_int_menu: - - struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, - const struct v4l2_ctrl_ops *ops, - u32 id, s32 max, s32 def, const s64 *qmenu_int); - These functions are typically called right after the v4l2_ctrl_handler_init: - static const s64 exp_bias_qmenu[] = { - -2, -1, 0, 1, 2 - }; - v4l2_ctrl_handler_init(&foo->ctrl_handler, nr_of_controls); v4l2_ctrl_new_std(&foo->ctrl_handler, &foo_ctrl_ops, V4L2_CID_BRIGHTNESS, 0, 255, 1, 128); @@ -151,11 +141,6 @@ These functions are typically called right after the v4l2_ctrl_handler_init: V4L2_CID_POWER_LINE_FREQUENCY, V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 0, V4L2_CID_POWER_LINE_FREQUENCY_DISABLED); - v4l2_ctrl_new_int_menu(&foo->ctrl_handler, &foo_ctrl_ops, - V4L2_CID_EXPOSURE_BIAS, - ARRAY_SIZE(exp_bias_qmenu) - 1, - ARRAY_SIZE(exp_bias_qmenu) / 2 - 1, - exp_bias_qmenu); ... if (foo->ctrl_handler.error) { int err = foo->ctrl_handler.error; @@ -179,12 +164,6 @@ controls. There is no min argument since that is always 0 for menu controls, and instead of a step there is a skip_mask argument: if bit X is 1, then menu item X is skipped. -The v4l2_ctrl_new_int_menu function creates a new standard integer menu -control with driver-specific items in the menu. It differs from -v4l2_ctrl_new_std_menu in that it doesn't have the mask argument and takes -as the last argument an array of signed 64-bit integers that form an exact -menu item list. - Note that if something fails, the function will return NULL or an error and set ctrl_handler->error to the error code. If ctrl_handler->error was already set, then it will just return and do nothing. This is also true for diff --git a/trunk/Documentation/video4linux/v4l2-framework.txt b/trunk/Documentation/video4linux/v4l2-framework.txt index 1f5905270050..659b2ba12a4f 100644 --- a/trunk/Documentation/video4linux/v4l2-framework.txt +++ b/trunk/Documentation/video4linux/v4l2-framework.txt @@ -182,11 +182,11 @@ static int __devinit drv_probe(struct pci_dev *pdev, } If you have multiple device nodes then it can be difficult to know when it is -safe to unregister v4l2_device for hotpluggable devices. For this purpose -v4l2_device has refcounting support. The refcount is increased whenever -video_register_device is called and it is decreased whenever that device node -is released. When the refcount reaches zero, then the v4l2_device release() -callback is called. You can do your final cleanup there. +safe to unregister v4l2_device. For this purpose v4l2_device has refcounting +support. The refcount is increased whenever video_register_device is called and +it is decreased whenever that device node is released. When the refcount reaches +zero, then the v4l2_device release() callback is called. You can do your final +cleanup there. If other device nodes (e.g. ALSA) are created, then you can increase and decrease the refcount manually as well by calling: @@ -197,10 +197,6 @@ or: int v4l2_device_put(struct v4l2_device *v4l2_dev); -Since the initial refcount is 1 you also need to call v4l2_device_put in the -disconnect() callback (for USB devices) or in the remove() callback (for e.g. -PCI devices), otherwise the refcount will never reach 0. - struct v4l2_subdev ------------------ @@ -266,16 +262,11 @@ struct v4l2_subdev_video_ops { ... }; -struct v4l2_subdev_pad_ops { - ... -}; - struct v4l2_subdev_ops { const struct v4l2_subdev_core_ops *core; const struct v4l2_subdev_tuner_ops *tuner; const struct v4l2_subdev_audio_ops *audio; const struct v4l2_subdev_video_ops *video; - const struct v4l2_subdev_pad_ops *video; }; The core ops are common to all subdevs, the other categories are implemented @@ -312,22 +303,6 @@ Don't forget to cleanup the media entity before the sub-device is destroyed: media_entity_cleanup(&sd->entity); -If the subdev driver intends to process video and integrate with the media -framework, it must implement format related functionality using -v4l2_subdev_pad_ops instead of v4l2_subdev_video_ops. - -In that case, the subdev driver may set the link_validate field to provide -its own link validation function. The link validation function is called for -every link in the pipeline where both of the ends of the links are V4L2 -sub-devices. The driver is still responsible for validating the correctness -of the format configuration between sub-devices and video nodes. - -If link_validate op is not set, the default function -v4l2_subdev_link_validate_default() is used instead. This function ensures -that width, height and the media bus pixel code are equal on both source and -sink of the link. Subdev drivers are also free to use this function to -perform the checks mentioned above in addition to their own checks. - A device (bridge) driver needs to register the v4l2_subdev with the v4l2_device: @@ -580,25 +555,19 @@ allocated memory. You should also set these fields: - v4l2_dev: set to the v4l2_device parent device. - - name: set to something descriptive and unique. - - fops: set to the v4l2_file_operations struct. - - ioctl_ops: if you use the v4l2_ioctl_ops to simplify ioctl maintenance (highly recommended to use this and it might become compulsory in the future!), then set this to your v4l2_ioctl_ops struct. - - lock: leave to NULL if you want to do all the locking in the driver. - Otherwise you give it a pointer to a struct mutex_lock and before the - unlocked_ioctl file operation is called this lock will be taken by the - core and released afterwards. See the next section for more details. - + Otherwise you give it a pointer to a struct mutex_lock and before any + of the v4l2_file_operations is called this lock will be taken by the + core and released afterwards. - prio: keeps track of the priorities. Used to implement VIDIOC_G/S_PRIORITY. If left to NULL, then it will use the struct v4l2_prio_state in v4l2_device. If you want to have a separate priority state per (group of) device node(s), then you can point it to your own struct v4l2_prio_state. - - parent: you only set this if v4l2_device was registered with NULL as the parent device struct. This only happens in cases where one hardware device has multiple PCI devices that all share the same v4l2_device core. @@ -608,7 +577,6 @@ You should also set these fields: (cx8802). Since the v4l2_device cannot be associated with a particular PCI device it is setup without a parent device. But when the struct video_device is setup you do know which parent PCI device to use. - - flags: optional. Set to V4L2_FL_USE_FH_PRIO if you want to let the framework handle the VIDIOC_G/S_PRIORITY ioctls. This requires that you use struct v4l2_fh. Eventually this flag will disappear once all drivers use the core @@ -619,16 +587,6 @@ in your v4l2_file_operations struct. Do not use .ioctl! This is deprecated and will go away in the future. -In some cases you want to tell the core that a function you had specified in -your v4l2_ioctl_ops should be ignored. You can mark such ioctls by calling this -function before video_device_register is called: - -void v4l2_disable_ioctl(struct video_device *vdev, unsigned int cmd); - -This tends to be needed if based on external factors (e.g. which card is -being used) you want to turns off certain features in v4l2_ioctl_ops without -having to make a new struct. - The v4l2_file_operations struct is a subset of file_operations. The main difference is that the inode argument is omitted since it is never used. @@ -651,22 +609,8 @@ v4l2_file_operations and locking -------------------------------- You can set a pointer to a mutex_lock in struct video_device. Usually this -will be either a top-level mutex or a mutex per device node. By default this -lock will be used for unlocked_ioctl, but you can disable locking for -selected ioctls by calling: - - void v4l2_disable_ioctl_locking(struct video_device *vdev, unsigned int cmd); - -E.g.: v4l2_disable_ioctl_locking(vdev, VIDIOC_DQBUF); - -You have to call this before you register the video_device. - -Particularly with USB drivers where certain commands such as setting controls -can take a long time you may want to do your own locking for the buffer queuing -ioctls. - -If you want still finer-grained locking then you have to set mutex_lock to NULL -and do you own locking completely. +will be either a top-level mutex or a mutex per device node. If you want +finer-grained locking then you have to set it to NULL and do you own locking. It is up to the driver developer to decide which method to use. However, if your driver has high-latency operations (for example, changing the exposure @@ -674,7 +618,7 @@ of a USB webcam might take a long time), then you might be better off with doing your own locking if you want to allow the user to do other things with the device while waiting for the high-latency command to finish. -If a lock is specified then all ioctl commands will be serialized on that +If a lock is specified then all file operations will be serialized on that lock. If you use videobuf then you must pass the same lock to the videobuf queue initialize function: if videobuf has to wait for a frame to arrive, then it will temporarily unlock the lock and relock it afterwards. If your driver @@ -997,35 +941,21 @@ fast. Useful functions: -void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev) +- v4l2_event_queue() Queue events to video device. The driver's only responsibility is to fill in the type and the data fields. The other fields will be filled in by V4L2. -int v4l2_event_subscribe(struct v4l2_fh *fh, - struct v4l2_event_subscription *sub, unsigned elems, - const struct v4l2_subscribed_event_ops *ops) +- v4l2_event_subscribe() The video_device->ioctl_ops->vidioc_subscribe_event must check the driver is able to produce events with specified event id. Then it calls - v4l2_event_subscribe() to subscribe the event. - - The elems argument is the size of the event queue for this event. If it is 0, - then the framework will fill in a default value (this depends on the event - type). - - The ops argument allows the driver to specify a number of callbacks: - * add: called when a new listener gets added (subscribing to the same - event twice will only cause this callback to get called once) - * del: called when a listener stops listening - * replace: replace event 'old' with event 'new'. - * merge: merge event 'old' into event 'new'. - All 4 callbacks are optional, if you don't want to specify any callbacks - the ops argument itself maybe NULL. + v4l2_event_subscribe() to subscribe the event. The last argument is the + size of the event queue for this event. If it is 0, then the framework + will fill in a default value (this depends on the event type). -int v4l2_event_unsubscribe(struct v4l2_fh *fh, - struct v4l2_event_subscription *sub) +- v4l2_event_unsubscribe() vidioc_unsubscribe_event in struct v4l2_ioctl_ops. A driver may use v4l2_event_unsubscribe() directly unless it wants to be involved in @@ -1034,7 +964,7 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh, The special type V4L2_EVENT_ALL may be used to unsubscribe all events. The drivers may want to handle this in a special way. -int v4l2_event_pending(struct v4l2_fh *fh) +- v4l2_event_pending() Returns the number of pending events. Useful when implementing poll. diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index eaff0392eb32..27a1d3c6eec8 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -2398,10 +2398,10 @@ F: drivers/gpu/drm/ F: include/drm/ INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) -M: Daniel Vetter +M: Keith Packard L: intel-gfx@lists.freedesktop.org (subscribers-only) L: dri-devel@lists.freedesktop.org -T: git git://people.freedesktop.org/~danvet/drm-intel +T: git git://git.kernel.org/pub/scm/linux/kernel/git/keithp/linux.git S: Supported F: drivers/gpu/drm/i915 F: include/drm/i915* @@ -2718,13 +2718,6 @@ S: Maintained F: Documentation/hwmon/f71805f F: drivers/hwmon/f71805f.c -FC0011 TUNER DRIVER -M: Michael Buesch -L: linux-media@vger.kernel.org -S: Maintained -F: drivers/media/common/tuners/fc0011.h -F: drivers/media/common/tuners/fc0011.c - FANOTIFY M: Eric Paris S: Maintained @@ -3465,8 +3458,6 @@ Q: http://patchwork.kernel.org/project/linux-input/list/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git S: Maintained F: drivers/input/ -F: include/linux/input.h -F: include/linux/input/ INPUT MULTITOUCH (MT) PROTOCOL M: Henrik Rydberg @@ -7200,7 +7191,7 @@ F: include/linux/usb/usbnet.h USB VIDEO CLASS M: Laurent Pinchart -L: linux-uvc-devel@lists.sourceforge.net (subscribers-only) +L: linux-uvc-devel@lists.berlios.de (subscribers-only) L: linux-media@vger.kernel.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git W: http://www.ideasonboard.org/uvc/ diff --git a/trunk/arch/Kconfig b/trunk/arch/Kconfig index e9a910876cda..1f9461b9cc89 100644 --- a/trunk/arch/Kconfig +++ b/trunk/arch/Kconfig @@ -76,23 +76,6 @@ config OPTPROBES depends on KPROBES && HAVE_OPTPROBES depends on !PREEMPT -config UPROBES - bool "Transparent user-space probes (EXPERIMENTAL)" - depends on UPROBE_EVENT && PERF_EVENTS - default n - help - Uprobes is the user-space counterpart to kprobes: they - enable instrumentation applications (such as 'perf probe') - to establish unintrusive probes in user-space binaries and - libraries, by executing handler functions when the probes - are hit by user-space applications. - - ( These probes come in the form of single-byte breakpoints, - managed by the kernel and kept transparent to the probed - application. ) - - If in doubt, say "N". - config HAVE_EFFICIENT_UNALIGNED_ACCESS bool help diff --git a/trunk/arch/alpha/Kconfig b/trunk/arch/alpha/Kconfig index 3de74c9f9610..0893f023efb8 100644 --- a/trunk/arch/alpha/Kconfig +++ b/trunk/arch/alpha/Kconfig @@ -16,7 +16,6 @@ config ALPHA select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_HAVE_NMI_SAFE_CMPXCHG select GENERIC_SMP_IDLE_THREAD - select GENERIC_CMOS_UPDATE help The Alpha is a 64-bit general-purpose processor designed and marketed by the Digital Equipment Corporation of blessed memory, @@ -49,6 +48,9 @@ config GENERIC_CALIBRATE_DELAY bool default y +config GENERIC_CMOS_UPDATE + def_bool y + config GENERIC_GPIO bool diff --git a/trunk/arch/alpha/include/asm/sysinfo.h b/trunk/arch/alpha/include/asm/sysinfo.h index e77d77cd07b8..0b80e79d75e5 100644 --- a/trunk/arch/alpha/include/asm/sysinfo.h +++ b/trunk/arch/alpha/include/asm/sysinfo.h @@ -15,6 +15,7 @@ #define GSI_GET_HWRPB 101 #define SSI_NVPAIRS 1 +#define SSI_LMF 7 #define SSI_IEEE_FP_CONTROL 14 #define SSI_IEEE_STATE_AT_SIGNAL 15 #define SSI_IEEE_IGNORE_STATE_AT_SIGNAL 16 diff --git a/trunk/arch/alpha/kernel/osf_sys.c b/trunk/arch/alpha/kernel/osf_sys.c index 49ee3193477a..9a81044a8947 100644 --- a/trunk/arch/alpha/kernel/osf_sys.c +++ b/trunk/arch/alpha/kernel/osf_sys.c @@ -771,6 +771,9 @@ SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer, return 0; } + case SSI_LMF: + return 0; + default: break; } diff --git a/trunk/arch/arm/Kconfig b/trunk/arch/arm/Kconfig index 312450941a1a..4f4c8115d79b 100644 --- a/trunk/arch/arm/Kconfig +++ b/trunk/arch/arm/Kconfig @@ -40,8 +40,6 @@ config ARM select GENERIC_PCI_IOMAP select HAVE_BPF_JIT select GENERIC_SMP_IDLE_THREAD - select KTIME_SCALAR - select GENERIC_CLOCKEVENTS_BROADCAST if SMP help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and @@ -65,6 +63,22 @@ config SYS_SUPPORTS_APM_EMULATION config GENERIC_GPIO bool +config ARCH_USES_GETTIMEOFFSET + bool + default n + +config GENERIC_CLOCKEVENTS + bool + +config GENERIC_CLOCKEVENTS_BROADCAST + bool + depends on GENERIC_CLOCKEVENTS + default y if SMP + +config KTIME_SCALAR + bool + default y + config HAVE_TCM bool select GENERIC_ALLOCATOR @@ -1424,6 +1438,8 @@ endmenu menu "Kernel Features" +source "kernel/time/Kconfig" + config HAVE_SMP bool help diff --git a/trunk/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/trunk/arch/arm/mach-imx/mach-imx27_visstrim_m10.c index dff82eb57cd9..748ba2e311b5 100644 --- a/trunk/arch/arm/mach-imx/mach-imx27_visstrim_m10.c +++ b/trunk/arch/arm/mach-imx/mach-imx27_visstrim_m10.c @@ -178,7 +178,7 @@ static struct soc_camera_link iclink_tvp5150 = { static struct mx2_camera_platform_data visstrim_camera = { .flags = MX2_CAMERA_CCIR | MX2_CAMERA_CCIR_INTERLACE | - MX2_CAMERA_PCLK_SAMPLE_RISING, + MX2_CAMERA_SWAP16 | MX2_CAMERA_PCLK_SAMPLE_RISING, .clk = 100000, }; diff --git a/trunk/arch/arm/plat-mxc/include/mach/mx2_cam.h b/trunk/arch/arm/plat-mxc/include/mach/mx2_cam.h index 7ded6f1f74bc..3c080a32dbf5 100644 --- a/trunk/arch/arm/plat-mxc/include/mach/mx2_cam.h +++ b/trunk/arch/arm/plat-mxc/include/mach/mx2_cam.h @@ -23,6 +23,7 @@ #ifndef __MACH_MX2_CAM_H_ #define __MACH_MX2_CAM_H_ +#define MX2_CAMERA_SWAP16 (1 << 0) #define MX2_CAMERA_EXT_VSYNC (1 << 1) #define MX2_CAMERA_CCIR (1 << 2) #define MX2_CAMERA_CCIR_INTERLACE (1 << 3) @@ -30,6 +31,7 @@ #define MX2_CAMERA_GATED_CLOCK (1 << 5) #define MX2_CAMERA_INV_DATA (1 << 6) #define MX2_CAMERA_PCLK_SAMPLE_RISING (1 << 7) +#define MX2_CAMERA_PACK_DIR_MSB (1 << 8) /** * struct mx2_camera_platform_data - optional platform data for mx2_camera diff --git a/trunk/arch/avr32/Kconfig b/trunk/arch/avr32/Kconfig index f8bc2d27d148..3dea7231f637 100644 --- a/trunk/arch/avr32/Kconfig +++ b/trunk/arch/avr32/Kconfig @@ -12,7 +12,6 @@ config AVR32 select HARDIRQS_SW_RESEND select GENERIC_IRQ_SHOW select ARCH_HAVE_NMI_SAFE_CMPXCHG - select GENERIC_CLOCKEVENTS help AVR32 is a high-performance 32-bit RISC microprocessor core, designed for cost-sensitive embedded applications, with particular @@ -36,6 +35,9 @@ config TRACE_IRQFLAGS_SUPPORT config RWSEM_GENERIC_SPINLOCK def_bool y +config GENERIC_CLOCKEVENTS + def_bool y + config RWSEM_XCHGADD_ALGORITHM def_bool n @@ -61,6 +63,8 @@ source "kernel/Kconfig.freezer" menu "System Type and features" +source "kernel/time/Kconfig" + config SUBARCH_AVR32B bool config MMU diff --git a/trunk/arch/blackfin/Kconfig b/trunk/arch/blackfin/Kconfig index 04ec0d8fbbb5..79cfe2614bcc 100644 --- a/trunk/arch/blackfin/Kconfig +++ b/trunk/arch/blackfin/Kconfig @@ -38,7 +38,6 @@ config BLACKFIN select IRQ_PER_CPU if SMP select HAVE_NMI_WATCHDOG if NMI_WATCHDOG select GENERIC_SMP_IDLE_THREAD - select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS config GENERIC_CSUM def_bool y @@ -643,10 +642,9 @@ comment "Kernel Timer/Scheduler" source kernel/Kconfig.hz -config SET_GENERIC_CLOCKEVENTS +config GENERIC_CLOCKEVENTS bool "Generic clock events" default y - select GENERIC_CLOCKEVENTS menu "Clock event device" depends on GENERIC_CLOCKEVENTS @@ -680,6 +678,12 @@ config GPTMR0_CLOCKSOURCE depends on !TICKSOURCE_GPTMR0 endmenu +config ARCH_USES_GETTIMEOFFSET + depends on !GENERIC_CLOCKEVENTS + def_bool y + +source kernel/time/Kconfig + comment "Misc" choice diff --git a/trunk/arch/c6x/Kconfig b/trunk/arch/c6x/Kconfig index 052f81a76239..1f15b88b537f 100644 --- a/trunk/arch/c6x/Kconfig +++ b/trunk/arch/c6x/Kconfig @@ -15,7 +15,6 @@ config C6X select IRQ_DOMAIN select OF select OF_EARLY_FLATTREE - select GENERIC_CLOCKEVENTS config MMU def_bool n @@ -32,6 +31,12 @@ config GENERIC_CALIBRATE_DELAY config GENERIC_HWEIGHT def_bool y +config GENERIC_CLOCKEVENTS + def_bool y + +config GENERIC_CLOCKEVENTS_BROADCAST + bool + config GENERIC_BUG def_bool y @@ -120,6 +125,7 @@ source "mm/Kconfig" source "kernel/Kconfig.preempt" source "kernel/Kconfig.hz" +source "kernel/time/Kconfig" endmenu diff --git a/trunk/arch/cris/Kconfig b/trunk/arch/cris/Kconfig index 22d34d64cc81..2995035812ec 100644 --- a/trunk/arch/cris/Kconfig +++ b/trunk/arch/cris/Kconfig @@ -13,6 +13,12 @@ config RWSEM_GENERIC_SPINLOCK config RWSEM_XCHGADD_ALGORITHM bool +config GENERIC_CMOS_UPDATE + def_bool y + +config ARCH_USES_GETTIMEOFFSET + def_bool n + config ARCH_HAS_ILOG2_U32 bool default n @@ -44,7 +50,6 @@ config CRIS select GENERIC_IRQ_SHOW select GENERIC_IOMAP select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32 - select GENERIC_CMOS_UPDATE config HZ int diff --git a/trunk/arch/h8300/Kconfig.cpu b/trunk/arch/h8300/Kconfig.cpu index 321f3922728b..15c22286ae79 100644 --- a/trunk/arch/h8300/Kconfig.cpu +++ b/trunk/arch/h8300/Kconfig.cpu @@ -1,5 +1,7 @@ menu "Processor type and features" +source "kernel/time/Kconfig" + choice prompt "H8/300 platform" default H8300H_GENERIC diff --git a/trunk/arch/hexagon/Kconfig b/trunk/arch/hexagon/Kconfig index b2fdfb700f50..bc979f770980 100644 --- a/trunk/arch/hexagon/Kconfig +++ b/trunk/arch/hexagon/Kconfig @@ -27,9 +27,6 @@ config HEXAGON select GENERIC_IOMAP select GENERIC_SMP_IDLE_THREAD select STACKTRACE_SUPPORT - select KTIME_SCALAR - select GENERIC_CLOCKEVENTS - select GENERIC_CLOCKEVENTS_BROADCAST ---help--- Qualcomm Hexagon is a processor architecture designed for high performance and low power across a wide variety of applications. @@ -58,6 +55,9 @@ config PCI config EARLY_PRINTK def_bool y +config KTIME_SCALAR + def_bool y + config MMU def_bool y @@ -88,6 +88,15 @@ config GENERIC_FIND_NEXT_BIT config GENERIC_HWEIGHT def_bool y +config GENERIC_TIME + def_bool y + +config GENERIC_CLOCKEVENTS + def_bool y + +config GENERIC_CLOCKEVENTS_BROADCAST + def_bool y + config STACKTRACE_SUPPORT def_bool y select STACKTRACE @@ -170,6 +179,7 @@ endchoice source "mm/Kconfig" source "kernel/Kconfig.hz" +source "kernel/time/Kconfig" config GENERIC_GPIO def_bool n diff --git a/trunk/arch/ia64/Kconfig b/trunk/arch/ia64/Kconfig index 8186ec5ea151..ba667b60f32d 100644 --- a/trunk/arch/ia64/Kconfig +++ b/trunk/arch/ia64/Kconfig @@ -37,8 +37,6 @@ config IA64 select ARCH_INIT_TASK select ARCH_TASK_STRUCT_ALLOCATOR select ARCH_THREAD_INFO_ALLOCATOR - select ARCH_CLOCKSOURCE_DATA - select GENERIC_TIME_VSYSCALL default y help The Itanium Processor Family is Intel's 64-bit successor to @@ -94,6 +92,10 @@ config GENERIC_CALIBRATE_DELAY bool default y +config GENERIC_TIME_VSYSCALL + bool + default y + config HAVE_SETUP_PER_CPU_AREA def_bool y @@ -108,6 +110,9 @@ config EFI bool default y +config ARCH_CLOCKSOURCE_DATA + def_bool y + config SCHED_OMIT_FRAME_POINTER bool default y diff --git a/trunk/arch/m32r/Kconfig b/trunk/arch/m32r/Kconfig index b638d5bfa14d..ef80a6546ff2 100644 --- a/trunk/arch/m32r/Kconfig +++ b/trunk/arch/m32r/Kconfig @@ -11,7 +11,6 @@ config M32R select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW select GENERIC_ATOMIC64 - select ARCH_USES_GETTIMEOFFSET config SBUS bool @@ -34,6 +33,9 @@ config HZ int default 100 +config ARCH_USES_GETTIMEOFFSET + def_bool y + source "init/Kconfig" source "kernel/Kconfig.freezer" diff --git a/trunk/arch/m68k/Kconfig b/trunk/arch/m68k/Kconfig index cac5b6be572a..d318c606c888 100644 --- a/trunk/arch/m68k/Kconfig +++ b/trunk/arch/m68k/Kconfig @@ -8,7 +8,6 @@ config M68K select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS select GENERIC_CPU_DEVICES select FPU if MMU - select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE config RWSEM_GENERIC_SPINLOCK bool @@ -23,6 +22,9 @@ config ARCH_HAS_ILOG2_U32 config ARCH_HAS_ILOG2_U64 bool +config GENERIC_CLOCKEVENTS + bool + config GENERIC_GPIO bool @@ -41,6 +43,9 @@ config TIME_LOW_RES bool default y +config ARCH_USES_GETTIMEOFFSET + def_bool MMU && !COLDFIRE + config NO_IOPORT def_bool y @@ -106,6 +111,10 @@ if COLDFIRE source "kernel/Kconfig.preempt" endif +if !MMU || COLDFIRE +source "kernel/time/Kconfig" +endif + source "mm/Kconfig" endmenu diff --git a/trunk/arch/microblaze/Kconfig b/trunk/arch/microblaze/Kconfig index 83460468998d..ac22dc7f4cab 100644 --- a/trunk/arch/microblaze/Kconfig +++ b/trunk/arch/microblaze/Kconfig @@ -22,7 +22,6 @@ config MICROBLAZE select GENERIC_PCI_IOMAP select GENERIC_CPU_DEVICES select GENERIC_ATOMIC64 - select GENERIC_CLOCKEVENTS config SWAP def_bool n @@ -51,6 +50,12 @@ config GENERIC_HWEIGHT config GENERIC_CALIBRATE_DELAY def_bool y +config GENERIC_TIME_VSYSCALL + def_bool n + +config GENERIC_CLOCKEVENTS + def_bool y + config GENERIC_GPIO def_bool y @@ -74,6 +79,8 @@ source "arch/microblaze/platform/Kconfig.platform" menu "Processor type and features" +source "kernel/time/Kconfig" + source "kernel/Kconfig.preempt" source "kernel/Kconfig.hz" diff --git a/trunk/arch/mips/Kconfig b/trunk/arch/mips/Kconfig index 3aa826bcbf96..85aad0321397 100644 --- a/trunk/arch/mips/Kconfig +++ b/trunk/arch/mips/Kconfig @@ -31,8 +31,6 @@ config MIPS select ARCH_DISCARD_MEMBLOCK select GENERIC_SMP_IDLE_THREAD select BUILDTIME_EXTABLE_SORT - select GENERIC_CLOCKEVENTS - select GENERIC_CMOS_UPDATE menu "Machine selection" @@ -860,6 +858,14 @@ config GENERIC_CALIBRATE_DELAY bool default y +config GENERIC_CLOCKEVENTS + bool + default y + +config GENERIC_CMOS_UPDATE + bool + default y + config SCHED_OMIT_FRAME_POINTER bool default y @@ -2046,6 +2052,9 @@ config CPU_HAS_SYNC depends on !CPU_R3000 default y +config GENERIC_CLOCKEVENTS_BROADCAST + bool + # # CPU non-features # @@ -2207,6 +2216,8 @@ config NR_CPUS performance should round up your number of processors to the next power of two. +source "kernel/time/Kconfig" + # # Timer Interrupt Frequency Configuration # diff --git a/trunk/arch/mips/bcm47xx/setup.c b/trunk/arch/mips/bcm47xx/setup.c index 95bf4d7bac21..19780aa91708 100644 --- a/trunk/arch/mips/bcm47xx/setup.c +++ b/trunk/arch/mips/bcm47xx/setup.c @@ -90,7 +90,6 @@ static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out) char prefix[10]; if (bus->bustype == SSB_BUSTYPE_PCI) { - memset(out, 0, sizeof(struct ssb_sprom)); snprintf(prefix, sizeof(prefix), "pci/%u/%u/", bus->host_pci->bus->number + 1, PCI_SLOT(bus->host_pci->devfn)); @@ -110,9 +109,15 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus, /* Fill boardinfo structure */ memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); - bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL); + if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0) + iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0); + else + iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM; + if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0) + iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); + if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0) + iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0); - memset(&iv->sprom, 0, sizeof(struct ssb_sprom)); bcm47xx_fill_sprom(&iv->sprom, NULL); if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0) @@ -161,14 +166,12 @@ static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) switch (bus->hosttype) { case BCMA_HOSTTYPE_PCI: - memset(out, 0, sizeof(struct ssb_sprom)); snprintf(prefix, sizeof(prefix), "pci/%u/%u/", bus->host_pci->bus->number + 1, PCI_SLOT(bus->host_pci->devfn)); bcm47xx_fill_sprom(out, prefix); return 0; case BCMA_HOSTTYPE_SOC: - memset(out, 0, sizeof(struct ssb_sprom)); bcm47xx_fill_sprom_ethernet(out, NULL); core = bcma_find_core(bus, BCMA_CORE_80211); if (core) { @@ -194,8 +197,6 @@ static void __init bcm47xx_register_bcma(void) err = bcma_host_soc_register(&bcm47xx_bus.bcma); if (err) panic("Failed to initialize BCMA bus (err %d)", err); - - bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL); } #endif diff --git a/trunk/arch/mips/bcm47xx/sprom.c b/trunk/arch/mips/bcm47xx/sprom.c index d3a889745e20..5c8dcd2a8a93 100644 --- a/trunk/arch/mips/bcm47xx/sprom.c +++ b/trunk/arch/mips/bcm47xx/sprom.c @@ -165,8 +165,6 @@ static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom, const char *prefix) { nvram_read_u16(prefix, NULL, "boardrev", &sprom->board_rev, 0); - if (!sprom->board_rev) - nvram_read_u16(NULL, NULL, "boardrev", &sprom->board_rev, 0); nvram_read_u16(prefix, NULL, "boardnum", &sprom->board_num, 0); nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff); nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff); @@ -557,6 +555,8 @@ void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix) void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix) { + memset(sprom, 0, sizeof(struct ssb_sprom)); + bcm47xx_fill_sprom_ethernet(sprom, prefix); nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0); @@ -618,27 +618,3 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix) bcm47xx_fill_sprom_r1(sprom, prefix); } } - -#ifdef CONFIG_BCM47XX_SSB -void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, - const char *prefix) -{ - nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0); - if (!boardinfo->vendor) - boardinfo->vendor = SSB_BOARDVENDOR_BCM; - - nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0); -} -#endif - -#ifdef CONFIG_BCM47XX_BCMA -void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo, - const char *prefix) -{ - nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0); - if (!boardinfo->vendor) - boardinfo->vendor = SSB_BOARDVENDOR_BCM; - - nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0); -} -#endif diff --git a/trunk/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/trunk/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h index 26fdaf40b930..5ecaf47b34d2 100644 --- a/trunk/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +++ b/trunk/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h @@ -47,13 +47,4 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type; void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix); void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix); -#ifdef CONFIG_BCM47XX_SSB -void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, - const char *prefix); -#endif -#ifdef CONFIG_BCM47XX_BCMA -void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo, - const char *prefix); -#endif - #endif /* __ASM_BCM47XX_H */ diff --git a/trunk/arch/mn10300/Kconfig b/trunk/arch/mn10300/Kconfig index 687f9b4a2ed6..3aa3de017159 100644 --- a/trunk/arch/mn10300/Kconfig +++ b/trunk/arch/mn10300/Kconfig @@ -6,7 +6,6 @@ config MN10300 select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_KGDB select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER - select GENERIC_CLOCKEVENTS config AM33_2 def_bool n @@ -43,9 +42,15 @@ config RWSEM_XCHGADD_ALGORITHM config GENERIC_CALIBRATE_DELAY def_bool y +config GENERIC_CMOS_UPDATE + def_bool n + config GENERIC_HWEIGHT def_bool y +config GENERIC_CLOCKEVENTS + def_bool y + config GENERIC_BUG def_bool y @@ -226,6 +231,7 @@ config MN10300_USING_JTAG single-stepping, which are taken over completely by the JTAG unit. source "kernel/Kconfig.hz" +source "kernel/time/Kconfig" config MN10300_RTC bool "Using MN10300 RTC" diff --git a/trunk/arch/openrisc/Kconfig b/trunk/arch/openrisc/Kconfig index 4932247d078a..297bd38f7c5d 100644 --- a/trunk/arch/openrisc/Kconfig +++ b/trunk/arch/openrisc/Kconfig @@ -18,7 +18,6 @@ config OPENRISC select GENERIC_IOMAP select GENERIC_CPU_DEVICES select GENERIC_ATOMIC64 - select GENERIC_CLOCKEVENTS config MMU def_bool y @@ -48,6 +47,9 @@ config NO_IOPORT config GENERIC_GPIO def_bool y +config GENERIC_CLOCKEVENTS + def_bool y + config TRACE_IRQFLAGS_SUPPORT def_bool y @@ -107,6 +109,7 @@ config OPENRISC_HAVE_INST_DIV endmenu +source "kernel/time/Kconfig" source kernel/Kconfig.hz source kernel/Kconfig.preempt source "mm/Kconfig" diff --git a/trunk/arch/powerpc/Kconfig b/trunk/arch/powerpc/Kconfig index 00b9874e2240..0a947bd9c076 100644 --- a/trunk/arch/powerpc/Kconfig +++ b/trunk/arch/powerpc/Kconfig @@ -27,6 +27,15 @@ config MMU bool default y +config GENERIC_CMOS_UPDATE + def_bool y + +config GENERIC_TIME_VSYSCALL + def_bool y + +config GENERIC_CLOCKEVENTS + def_bool y + config HAVE_SETUP_PER_CPU_AREA def_bool PPC64 @@ -132,9 +141,6 @@ config PPC select HAVE_ARCH_JUMP_LABEL select ARCH_HAVE_NMI_SAFE_CMPXCHG select GENERIC_SMP_IDLE_THREAD - select GENERIC_CMOS_UPDATE - select GENERIC_TIME_VSYSCALL - select GENERIC_CLOCKEVENTS config EARLY_PRINTK bool @@ -275,6 +281,7 @@ config HIGHMEM bool "High memory support" depends on PPC32 +source kernel/time/Kconfig source kernel/Kconfig.hz source kernel/Kconfig.preempt source "fs/Kconfig.binfmt" diff --git a/trunk/arch/s390/Kconfig b/trunk/arch/s390/Kconfig index b403c533432c..e16390c0bca8 100644 --- a/trunk/arch/s390/Kconfig +++ b/trunk/arch/s390/Kconfig @@ -28,6 +28,12 @@ config ARCH_HAS_ILOG2_U64 config GENERIC_HWEIGHT def_bool y +config GENERIC_TIME_VSYSCALL + def_bool y + +config GENERIC_CLOCKEVENTS + def_bool y + config GENERIC_BUG def_bool y if BUG @@ -117,9 +123,6 @@ config S390 select ARCH_INLINE_WRITE_UNLOCK_IRQ select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE select GENERIC_SMP_IDLE_THREAD - select GENERIC_TIME_VSYSCALL - select GENERIC_CLOCKEVENTS - select KTIME_SCALAR if 32BIT config SCHED_OMIT_FRAME_POINTER def_bool y @@ -132,6 +135,8 @@ menu "Base setup" comment "Processor type and features" +source "kernel/time/Kconfig" + config 64BIT def_bool y prompt "64 bit kernel" @@ -142,6 +147,9 @@ config 64BIT config 32BIT def_bool y if !64BIT +config KTIME_SCALAR + def_bool 32BIT + config SMP def_bool y prompt "Symmetric multi-processing support" diff --git a/trunk/arch/score/Kconfig b/trunk/arch/score/Kconfig index ba0f412920be..4b285779ac05 100644 --- a/trunk/arch/score/Kconfig +++ b/trunk/arch/score/Kconfig @@ -9,7 +9,6 @@ config SCORE select HAVE_MEMBLOCK_NODE_MAP select ARCH_DISCARD_MEMBLOCK select GENERIC_CPU_DEVICES - select GENERIC_CLOCKEVENTS choice prompt "System type" @@ -52,6 +51,9 @@ config GENERIC_HWEIGHT config GENERIC_CALIBRATE_DELAY def_bool y +config GENERIC_CLOCKEVENTS + def_bool y + menu "Kernel type" config 32BIT @@ -66,6 +68,7 @@ config MEMORY_START hex default 0xa0000000 +source "kernel/time/Kconfig" source "kernel/Kconfig.hz" source "kernel/Kconfig.preempt" diff --git a/trunk/arch/sh/Kconfig b/trunk/arch/sh/Kconfig index 5e05c0b445bb..3e723aaa5e18 100644 --- a/trunk/arch/sh/Kconfig +++ b/trunk/arch/sh/Kconfig @@ -29,8 +29,6 @@ config SUPERH select GENERIC_ATOMIC64 select GENERIC_IRQ_SHOW select GENERIC_SMP_IDLE_THREAD - select GENERIC_CLOCKEVENTS - select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST help The SuperH is a RISC processor targeted for use in embedded systems and consumer electronics; it was also used in the Sega Dreamcast @@ -89,6 +87,16 @@ config GENERIC_GPIO config GENERIC_CALIBRATE_DELAY bool +config GENERIC_CLOCKEVENTS + def_bool y + +config GENERIC_CLOCKEVENTS_BROADCAST + bool + +config GENERIC_CMOS_UPDATE + def_bool y + depends on SH_SH03 || SH_DREAMCAST + config GENERIC_LOCKBREAK def_bool y depends on SMP && PREEMPT @@ -603,6 +611,8 @@ config SH_CLK_CPG_LEGACY !CPU_SUBTYPE_SH7734 && !CPU_SUBTYPE_SH7264 && \ !CPU_SUBTYPE_SH7269 +source "kernel/time/Kconfig" + endmenu menu "CPU Frequency scaling" diff --git a/trunk/arch/sparc/Kconfig b/trunk/arch/sparc/Kconfig index 2d493a3bdfe1..1ea3fd954756 100644 --- a/trunk/arch/sparc/Kconfig +++ b/trunk/arch/sparc/Kconfig @@ -32,15 +32,12 @@ config SPARC select HAVE_NMI_WATCHDOG if SPARC64 select HAVE_BPF_JIT select GENERIC_SMP_IDLE_THREAD - select GENERIC_CMOS_UPDATE - select GENERIC_CLOCKEVENTS config SPARC32 def_bool !64BIT select GENERIC_ATOMIC64 select CLZ_TAB select ARCH_THREAD_INFO_ALLOCATOR - select ARCH_USES_GETTIMEOFFSET config SPARC64 def_bool 64BIT @@ -80,6 +77,13 @@ config BITS default 32 if SPARC32 default 64 if SPARC64 +config GENERIC_CMOS_UPDATE + bool + default y + +config GENERIC_CLOCKEVENTS + def_bool y + config IOMMU_HELPER bool default y if SPARC64 @@ -270,6 +274,8 @@ config HOTPLUG_CPU can be controlled through /sys/devices/system/cpu/cpu#. Say N if you want to disable CPU hotplug. +source "kernel/time/Kconfig" + if SPARC64 source "drivers/cpufreq/Kconfig" diff --git a/trunk/arch/tile/Kconfig b/trunk/arch/tile/Kconfig index 6ad6219fc47e..74239dd77e06 100644 --- a/trunk/arch/tile/Kconfig +++ b/trunk/arch/tile/Kconfig @@ -14,7 +14,6 @@ config TILE select HAVE_SYSCALL_WRAPPERS if TILEGX select SYS_HYPERVISOR select ARCH_HAVE_NMI_SAFE_CMPXCHG - select GENERIC_CLOCKEVENTS # FIXME: investigate whether we need/want these options. # select HAVE_IOREMAP_PROT @@ -48,6 +47,9 @@ config NEED_PER_CPU_PAGE_FIRST_CHUNK config SYS_SUPPORTS_HUGETLBFS def_bool y +config GENERIC_CLOCKEVENTS + def_bool y + # FIXME: tilegx can implement a more efficient rwsem. config RWSEM_GENERIC_SPINLOCK def_bool y @@ -137,6 +139,8 @@ config NR_CPUS smaller kernel memory footprint results from using a smaller value on chips with fewer tiles. +source "kernel/time/Kconfig" + source "kernel/Kconfig.hz" config KEXEC diff --git a/trunk/arch/um/Kconfig.common b/trunk/arch/um/Kconfig.common index cb837c223922..43ef890d292c 100644 --- a/trunk/arch/um/Kconfig.common +++ b/trunk/arch/um/Kconfig.common @@ -10,7 +10,6 @@ config UML select GENERIC_IRQ_SHOW select GENERIC_CPU_DEVICES select GENERIC_IO - select GENERIC_CLOCKEVENTS config MMU bool @@ -53,6 +52,10 @@ config GENERIC_BUG default y depends on BUG +config GENERIC_CLOCKEVENTS + bool + default y + config HZ int default 100 diff --git a/trunk/arch/um/Kconfig.um b/trunk/arch/um/Kconfig.um index bf87f25eb2de..70fd690964e4 100644 --- a/trunk/arch/um/Kconfig.um +++ b/trunk/arch/um/Kconfig.um @@ -10,6 +10,7 @@ config STATIC_LINK 2.75G) for UML. source "mm/Kconfig" +source "kernel/time/Kconfig" config LD_SCRIPT_STATIC bool diff --git a/trunk/arch/unicore32/Kconfig b/trunk/arch/unicore32/Kconfig index 47ad5210606f..eeb8054c7cd8 100644 --- a/trunk/arch/unicore32/Kconfig +++ b/trunk/arch/unicore32/Kconfig @@ -25,6 +25,9 @@ config HAVE_PWM config GENERIC_GPIO def_bool y +config GENERIC_CLOCKEVENTS + bool + config GENERIC_CSUM def_bool y @@ -143,6 +146,8 @@ endmenu menu "Kernel Features" +source "kernel/time/Kconfig" + source "kernel/Kconfig.preempt" source "kernel/Kconfig.hz" diff --git a/trunk/arch/x86/Kconfig b/trunk/arch/x86/Kconfig index 66cc380bebf0..d6168994e115 100644 --- a/trunk/arch/x86/Kconfig +++ b/trunk/arch/x86/Kconfig @@ -85,16 +85,9 @@ config X86 select GENERIC_SMP_IDLE_THREAD select HAVE_ARCH_SECCOMP_FILTER select BUILDTIME_EXTABLE_SORT - select GENERIC_CMOS_UPDATE - select CLOCKSOURCE_WATCHDOG - select GENERIC_CLOCKEVENTS - select ARCH_CLOCKSOURCE_DATA if X86_64 - select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && X86_LOCAL_APIC) - select GENERIC_TIME_VSYSCALL if X86_64 - select KTIME_SCALAR if X86_32 config INSTRUCTION_DECODER - def_bool (KPROBES || PERF_EVENTS || UPROBES) + def_bool (KPROBES || PERF_EVENTS) config OUTPUT_FORMAT string @@ -106,6 +99,23 @@ config ARCH_DEFCONFIG default "arch/x86/configs/i386_defconfig" if X86_32 default "arch/x86/configs/x86_64_defconfig" if X86_64 +config GENERIC_CMOS_UPDATE + def_bool y + +config CLOCKSOURCE_WATCHDOG + def_bool y + +config GENERIC_CLOCKEVENTS + def_bool y + +config ARCH_CLOCKSOURCE_DATA + def_bool y + depends on X86_64 + +config GENERIC_CLOCKEVENTS_BROADCAST + def_bool y + depends on X86_64 || (X86_32 && X86_LOCAL_APIC) + config LOCKDEP_SUPPORT def_bool y @@ -156,6 +166,10 @@ config RWSEM_XCHGADD_ALGORITHM config GENERIC_CALIBRATE_DELAY def_bool y +config GENERIC_TIME_VSYSCALL + bool + default X86_64 + config ARCH_HAS_CPU_RELAX def_bool y @@ -222,13 +236,13 @@ config ARCH_HWEIGHT_CFLAGS default "-fcall-saved-ecx -fcall-saved-edx" if X86_32 default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64 +config KTIME_SCALAR + def_bool X86_32 + config ARCH_CPU_PROBE_RELEASE def_bool y depends on HOTPLUG_CPU -config ARCH_SUPPORTS_UPROBES - def_bool y - source "init/Kconfig" source "kernel/Kconfig.freezer" @@ -244,6 +258,8 @@ config ZONE_DMA If unsure, say Y. +source "kernel/time/Kconfig" + config SMP bool "Symmetric multi-processing support" ---help--- diff --git a/trunk/arch/x86/include/asm/thread_info.h b/trunk/arch/x86/include/asm/thread_info.h index 5c25de07cba8..3c9aebc00d39 100644 --- a/trunk/arch/x86/include/asm/thread_info.h +++ b/trunk/arch/x86/include/asm/thread_info.h @@ -85,7 +85,6 @@ struct thread_info { #define TIF_SECCOMP 8 /* secure computing */ #define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */ #define TIF_USER_RETURN_NOTIFY 11 /* notify kernel of userspace return */ -#define TIF_UPROBE 12 /* breakpointed or singlestepping */ #define TIF_NOTSC 16 /* TSC is not accessible in userland */ #define TIF_IA32 17 /* IA32 compatibility process */ #define TIF_FORK 18 /* ret_from_fork */ @@ -110,7 +109,6 @@ struct thread_info { #define _TIF_SECCOMP (1 << TIF_SECCOMP) #define _TIF_MCE_NOTIFY (1 << TIF_MCE_NOTIFY) #define _TIF_USER_RETURN_NOTIFY (1 << TIF_USER_RETURN_NOTIFY) -#define _TIF_UPROBE (1 << TIF_UPROBE) #define _TIF_NOTSC (1 << TIF_NOTSC) #define _TIF_IA32 (1 << TIF_IA32) #define _TIF_FORK (1 << TIF_FORK) diff --git a/trunk/arch/x86/include/asm/uprobes.h b/trunk/arch/x86/include/asm/uprobes.h deleted file mode 100644 index 1e9bed14f7ae..000000000000 --- a/trunk/arch/x86/include/asm/uprobes.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _ASM_UPROBES_H -#define _ASM_UPROBES_H -/* - * User-space Probes (UProbes) for x86 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright (C) IBM Corporation, 2008-2011 - * Authors: - * Srikar Dronamraju - * Jim Keniston - */ - -#include - -typedef u8 uprobe_opcode_t; - -#define MAX_UINSN_BYTES 16 -#define UPROBE_XOL_SLOT_BYTES 128 /* to keep it cache aligned */ - -#define UPROBE_SWBP_INSN 0xcc -#define UPROBE_SWBP_INSN_SIZE 1 - -struct arch_uprobe { - u16 fixups; - u8 insn[MAX_UINSN_BYTES]; -#ifdef CONFIG_X86_64 - unsigned long rip_rela_target_address; -#endif -}; - -struct arch_uprobe_task { - unsigned long saved_trap_nr; -#ifdef CONFIG_X86_64 - unsigned long saved_scratch_register; -#endif -}; - -extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm); -extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs); -extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs); -extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk); -extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); -extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); -#endif /* _ASM_UPROBES_H */ diff --git a/trunk/arch/x86/include/asm/vga.h b/trunk/arch/x86/include/asm/vga.h index 44282fbf7bf9..c4b9dc2f67c5 100644 --- a/trunk/arch/x86/include/asm/vga.h +++ b/trunk/arch/x86/include/asm/vga.h @@ -17,10 +17,4 @@ #define vga_readb(x) (*(x)) #define vga_writeb(x, y) (*(y) = (x)) -#ifdef CONFIG_FB_EFI -#define __ARCH_HAS_VGA_DEFAULT_DEVICE -extern struct pci_dev *vga_default_device(void); -extern void vga_set_default_device(struct pci_dev *pdev); -#endif - #endif /* _ASM_X86_VGA_H */ diff --git a/trunk/arch/x86/kernel/Makefile b/trunk/arch/x86/kernel/Makefile index 9bba5b79902b..bb8529275aab 100644 --- a/trunk/arch/x86/kernel/Makefile +++ b/trunk/arch/x86/kernel/Makefile @@ -100,7 +100,6 @@ obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o obj-$(CONFIG_OF) += devicetree.o -obj-$(CONFIG_UPROBES) += uprobes.o ### # 64 bit specific files diff --git a/trunk/arch/x86/kernel/hpet.c b/trunk/arch/x86/kernel/hpet.c index 9cc7b4392f7c..ad0de0c2714e 100644 --- a/trunk/arch/x86/kernel/hpet.c +++ b/trunk/arch/x86/kernel/hpet.c @@ -94,18 +94,13 @@ static int hpet_verbose; static int __init hpet_setup(char *str) { - while (str) { - char *next = strchr(str, ','); - - if (next) - *next++ = 0; + if (str) { if (!strncmp("disable", str, 7)) boot_hpet_disable = 1; if (!strncmp("force", str, 5)) hpet_force_user = 1; if (!strncmp("verbose", str, 7)) hpet_verbose = 1; - str = next; } return 1; } @@ -324,6 +319,8 @@ static void hpet_set_mode(enum clock_event_mode mode, now = hpet_readl(HPET_COUNTER); cmp = now + (unsigned int) delta; cfg = hpet_readl(HPET_Tn_CFG(timer)); + /* Make sure we use edge triggered interrupts */ + cfg &= ~HPET_TN_LEVEL; cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC | HPET_TN_SETVAL | HPET_TN_32BIT; hpet_writel(cfg, HPET_Tn_CFG(timer)); @@ -790,16 +787,15 @@ static int hpet_clocksource_register(void) return 0; } -static u32 *hpet_boot_cfg; - /** * hpet_enable - Try to setup the HPET timer. Returns 1 on success. */ int __init hpet_enable(void) { - u32 hpet_period, cfg, id; + unsigned long hpet_period; + unsigned int id; u64 freq; - unsigned int i, last; + int i; if (!is_hpet_capable()) return 0; @@ -851,45 +847,15 @@ int __init hpet_enable(void) id = hpet_readl(HPET_ID); hpet_print_config(); - last = (id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT; - #ifdef CONFIG_HPET_EMULATE_RTC /* * The legacy routing mode needs at least two channels, tick timer * and the rtc emulation channel. */ - if (!last) + if (!(id & HPET_ID_NUMBER)) goto out_nohpet; #endif - cfg = hpet_readl(HPET_CFG); - hpet_boot_cfg = kmalloc((last + 2) * sizeof(*hpet_boot_cfg), - GFP_KERNEL); - if (hpet_boot_cfg) - *hpet_boot_cfg = cfg; - else - pr_warn("HPET initial state will not be saved\n"); - cfg &= ~(HPET_CFG_ENABLE | HPET_CFG_LEGACY); - hpet_writel(cfg, HPET_Tn_CFG(i)); - if (cfg) - pr_warn("HPET: Unrecognized bits %#x set in global cfg\n", - cfg); - - for (i = 0; i <= last; ++i) { - cfg = hpet_readl(HPET_Tn_CFG(i)); - if (hpet_boot_cfg) - hpet_boot_cfg[i + 1] = cfg; - cfg &= ~(HPET_TN_ENABLE | HPET_TN_LEVEL | HPET_TN_FSB); - hpet_writel(cfg, HPET_Tn_CFG(i)); - cfg &= ~(HPET_TN_PERIODIC | HPET_TN_PERIODIC_CAP - | HPET_TN_64BIT_CAP | HPET_TN_32BIT | HPET_TN_ROUTE - | HPET_TN_FSB | HPET_TN_FSB_CAP); - if (cfg) - pr_warn("HPET: Unrecognized bits %#x set in cfg#%u\n", - cfg, i); - } - hpet_print_config(); - if (hpet_clocksource_register()) goto out_nohpet; @@ -957,28 +923,14 @@ fs_initcall(hpet_late_init); void hpet_disable(void) { if (is_hpet_capable() && hpet_virt_address) { - unsigned int cfg = hpet_readl(HPET_CFG), id, last; + unsigned int cfg = hpet_readl(HPET_CFG); - if (hpet_boot_cfg) - cfg = *hpet_boot_cfg; - else if (hpet_legacy_int_enabled) { + if (hpet_legacy_int_enabled) { cfg &= ~HPET_CFG_LEGACY; hpet_legacy_int_enabled = 0; } cfg &= ~HPET_CFG_ENABLE; hpet_writel(cfg, HPET_CFG); - - if (!hpet_boot_cfg) - return; - - id = hpet_readl(HPET_ID); - last = ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT); - - for (id = 0; id <= last; ++id) - hpet_writel(hpet_boot_cfg[id + 1], HPET_Tn_CFG(id)); - - if (*hpet_boot_cfg & HPET_CFG_ENABLE) - hpet_writel(*hpet_boot_cfg, HPET_CFG); } } diff --git a/trunk/arch/x86/kernel/signal.c b/trunk/arch/x86/kernel/signal.c index 965dfda0fd5e..b68ccadd2ff4 100644 --- a/trunk/arch/x86/kernel/signal.c +++ b/trunk/arch/x86/kernel/signal.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -815,11 +814,6 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags) mce_notify_process(); #endif /* CONFIG_X86_64 && CONFIG_X86_MCE */ - if (thread_info_flags & _TIF_UPROBE) { - clear_thread_flag(TIF_UPROBE); - uprobe_notify_resume(regs); - } - /* deal with pending signal delivery */ if (thread_info_flags & _TIF_SIGPENDING) do_signal(regs); diff --git a/trunk/arch/x86/kernel/uprobes.c b/trunk/arch/x86/kernel/uprobes.c deleted file mode 100644 index dc4e910a7d96..000000000000 --- a/trunk/arch/x86/kernel/uprobes.c +++ /dev/null @@ -1,674 +0,0 @@ -/* - * User-space Probes (UProbes) for x86 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright (C) IBM Corporation, 2008-2011 - * Authors: - * Srikar Dronamraju - * Jim Keniston - */ -#include -#include -#include -#include -#include - -#include -#include -#include - -/* Post-execution fixups. */ - -/* No fixup needed */ -#define UPROBE_FIX_NONE 0x0 - -/* Adjust IP back to vicinity of actual insn */ -#define UPROBE_FIX_IP 0x1 - -/* Adjust the return address of a call insn */ -#define UPROBE_FIX_CALL 0x2 - -#define UPROBE_FIX_RIP_AX 0x8000 -#define UPROBE_FIX_RIP_CX 0x4000 - -#define UPROBE_TRAP_NR UINT_MAX - -/* Adaptations for mhiramat x86 decoder v14. */ -#define OPCODE1(insn) ((insn)->opcode.bytes[0]) -#define OPCODE2(insn) ((insn)->opcode.bytes[1]) -#define OPCODE3(insn) ((insn)->opcode.bytes[2]) -#define MODRM_REG(insn) X86_MODRM_REG(insn->modrm.value) - -#define W(row, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf)\ - (((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) | \ - (b4##UL << 0x4)|(b5##UL << 0x5)|(b6##UL << 0x6)|(b7##UL << 0x7) | \ - (b8##UL << 0x8)|(b9##UL << 0x9)|(ba##UL << 0xa)|(bb##UL << 0xb) | \ - (bc##UL << 0xc)|(bd##UL << 0xd)|(be##UL << 0xe)|(bf##UL << 0xf)) \ - << (row % 32)) - -/* - * Good-instruction tables for 32-bit apps. This is non-const and volatile - * to keep gcc from statically optimizing it out, as variable_test_bit makes - * some versions of gcc to think only *(unsigned long*) is used. - */ -static volatile u32 good_insns_32[256 / 32] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /* ---------------------------------------------- */ - W(0x00, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0) | /* 00 */ - W(0x10, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0) , /* 10 */ - W(0x20, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1) | /* 20 */ - W(0x30, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1) , /* 30 */ - W(0x40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 40 */ - W(0x50, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 50 */ - W(0x60, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0) | /* 60 */ - W(0x70, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 70 */ - W(0x80, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 80 */ - W(0x90, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 90 */ - W(0xa0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* a0 */ - W(0xb0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* b0 */ - W(0xc0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0) | /* c0 */ - W(0xd0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* d0 */ - W(0xe0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0) | /* e0 */ - W(0xf0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1) /* f0 */ - /* ---------------------------------------------- */ - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ -}; - -/* Using this for both 64-bit and 32-bit apps */ -static volatile u32 good_2byte_insns[256 / 32] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /* ---------------------------------------------- */ - W(0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1) | /* 00 */ - W(0x10, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1) , /* 10 */ - W(0x20, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1) | /* 20 */ - W(0x30, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) , /* 30 */ - W(0x40, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 40 */ - W(0x50, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 50 */ - W(0x60, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 60 */ - W(0x70, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1) , /* 70 */ - W(0x80, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 80 */ - W(0x90, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 90 */ - W(0xa0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1) | /* a0 */ - W(0xb0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1) , /* b0 */ - W(0xc0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* c0 */ - W(0xd0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* d0 */ - W(0xe0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* e0 */ - W(0xf0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0) /* f0 */ - /* ---------------------------------------------- */ - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ -}; - -#ifdef CONFIG_X86_64 -/* Good-instruction tables for 64-bit apps */ -static volatile u32 good_insns_64[256 / 32] = { - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ - /* ---------------------------------------------- */ - W(0x00, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0) | /* 00 */ - W(0x10, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0) , /* 10 */ - W(0x20, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0) | /* 20 */ - W(0x30, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0) , /* 30 */ - W(0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) | /* 40 */ - W(0x50, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 50 */ - W(0x60, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0) | /* 60 */ - W(0x70, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 70 */ - W(0x80, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 80 */ - W(0x90, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 90 */ - W(0xa0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* a0 */ - W(0xb0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* b0 */ - W(0xc0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0) | /* c0 */ - W(0xd0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* d0 */ - W(0xe0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0) | /* e0 */ - W(0xf0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1) /* f0 */ - /* ---------------------------------------------- */ - /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ -}; -#endif -#undef W - -/* - * opcodes we'll probably never support: - * - * 6c-6d, e4-e5, ec-ed - in - * 6e-6f, e6-e7, ee-ef - out - * cc, cd - int3, int - * cf - iret - * d6 - illegal instruction - * f1 - int1/icebp - * f4 - hlt - * fa, fb - cli, sti - * 0f - lar, lsl, syscall, clts, sysret, sysenter, sysexit, invd, wbinvd, ud2 - * - * invalid opcodes in 64-bit mode: - * - * 06, 0e, 16, 1e, 27, 2f, 37, 3f, 60-62, 82, c4-c5, d4-d5 - * 63 - we support this opcode in x86_64 but not in i386. - * - * opcodes we may need to refine support for: - * - * 0f - 2-byte instructions: For many of these instructions, the validity - * depends on the prefix and/or the reg field. On such instructions, we - * just consider the opcode combination valid if it corresponds to any - * valid instruction. - * - * 8f - Group 1 - only reg = 0 is OK - * c6-c7 - Group 11 - only reg = 0 is OK - * d9-df - fpu insns with some illegal encodings - * f2, f3 - repnz, repz prefixes. These are also the first byte for - * certain floating-point instructions, such as addsd. - * - * fe - Group 4 - only reg = 0 or 1 is OK - * ff - Group 5 - only reg = 0-6 is OK - * - * others -- Do we need to support these? - * - * 0f - (floating-point?) prefetch instructions - * 07, 17, 1f - pop es, pop ss, pop ds - * 26, 2e, 36, 3e - es:, cs:, ss:, ds: segment prefixes -- - * but 64 and 65 (fs: and gs:) seem to be used, so we support them - * 67 - addr16 prefix - * ce - into - * f0 - lock prefix - */ - -/* - * TODO: - * - Where necessary, examine the modrm byte and allow only valid instructions - * in the different Groups and fpu instructions. - */ - -static bool is_prefix_bad(struct insn *insn) -{ - int i; - - for (i = 0; i < insn->prefixes.nbytes; i++) { - switch (insn->prefixes.bytes[i]) { - case 0x26: /* INAT_PFX_ES */ - case 0x2E: /* INAT_PFX_CS */ - case 0x36: /* INAT_PFX_DS */ - case 0x3E: /* INAT_PFX_SS */ - case 0xF0: /* INAT_PFX_LOCK */ - return true; - } - } - return false; -} - -static int validate_insn_32bits(struct arch_uprobe *auprobe, struct insn *insn) -{ - insn_init(insn, auprobe->insn, false); - - /* Skip good instruction prefixes; reject "bad" ones. */ - insn_get_opcode(insn); - if (is_prefix_bad(insn)) - return -ENOTSUPP; - - if (test_bit(OPCODE1(insn), (unsigned long *)good_insns_32)) - return 0; - - if (insn->opcode.nbytes == 2) { - if (test_bit(OPCODE2(insn), (unsigned long *)good_2byte_insns)) - return 0; - } - - return -ENOTSUPP; -} - -/* - * Figure out which fixups arch_uprobe_post_xol() will need to perform, and - * annotate arch_uprobe->fixups accordingly. To start with, - * arch_uprobe->fixups is either zero or it reflects rip-related fixups. - */ -static void prepare_fixups(struct arch_uprobe *auprobe, struct insn *insn) -{ - bool fix_ip = true, fix_call = false; /* defaults */ - int reg; - - insn_get_opcode(insn); /* should be a nop */ - - switch (OPCODE1(insn)) { - case 0xc3: /* ret/lret */ - case 0xcb: - case 0xc2: - case 0xca: - /* ip is correct */ - fix_ip = false; - break; - case 0xe8: /* call relative - Fix return addr */ - fix_call = true; - break; - case 0x9a: /* call absolute - Fix return addr, not ip */ - fix_call = true; - fix_ip = false; - break; - case 0xff: - insn_get_modrm(insn); - reg = MODRM_REG(insn); - if (reg == 2 || reg == 3) { - /* call or lcall, indirect */ - /* Fix return addr; ip is correct. */ - fix_call = true; - fix_ip = false; - } else if (reg == 4 || reg == 5) { - /* jmp or ljmp, indirect */ - /* ip is correct. */ - fix_ip = false; - } - break; - case 0xea: /* jmp absolute -- ip is correct */ - fix_ip = false; - break; - default: - break; - } - if (fix_ip) - auprobe->fixups |= UPROBE_FIX_IP; - if (fix_call) - auprobe->fixups |= UPROBE_FIX_CALL; -} - -#ifdef CONFIG_X86_64 -/* - * If arch_uprobe->insn doesn't use rip-relative addressing, return - * immediately. Otherwise, rewrite the instruction so that it accesses - * its memory operand indirectly through a scratch register. Set - * arch_uprobe->fixups and arch_uprobe->rip_rela_target_address - * accordingly. (The contents of the scratch register will be saved - * before we single-step the modified instruction, and restored - * afterward.) - * - * We do this because a rip-relative instruction can access only a - * relatively small area (+/- 2 GB from the instruction), and the XOL - * area typically lies beyond that area. At least for instructions - * that store to memory, we can't execute the original instruction - * and "fix things up" later, because the misdirected store could be - * disastrous. - * - * Some useful facts about rip-relative instructions: - * - * - There's always a modrm byte. - * - There's never a SIB byte. - * - The displacement is always 4 bytes. - */ -static void -handle_riprel_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, struct insn *insn) -{ - u8 *cursor; - u8 reg; - - if (mm->context.ia32_compat) - return; - - auprobe->rip_rela_target_address = 0x0; - if (!insn_rip_relative(insn)) - return; - - /* - * insn_rip_relative() would have decoded rex_prefix, modrm. - * Clear REX.b bit (extension of MODRM.rm field): - * we want to encode rax/rcx, not r8/r9. - */ - if (insn->rex_prefix.nbytes) { - cursor = auprobe->insn + insn_offset_rex_prefix(insn); - *cursor &= 0xfe; /* Clearing REX.B bit */ - } - - /* - * Point cursor at the modrm byte. The next 4 bytes are the - * displacement. Beyond the displacement, for some instructions, - * is the immediate operand. - */ - cursor = auprobe->insn + insn_offset_modrm(insn); - insn_get_length(insn); - - /* - * Convert from rip-relative addressing to indirect addressing - * via a scratch register. Change the r/m field from 0x5 (%rip) - * to 0x0 (%rax) or 0x1 (%rcx), and squeeze out the offset field. - */ - reg = MODRM_REG(insn); - if (reg == 0) { - /* - * The register operand (if any) is either the A register - * (%rax, %eax, etc.) or (if the 0x4 bit is set in the - * REX prefix) %r8. In any case, we know the C register - * is NOT the register operand, so we use %rcx (register - * #1) for the scratch register. - */ - auprobe->fixups = UPROBE_FIX_RIP_CX; - /* Change modrm from 00 000 101 to 00 000 001. */ - *cursor = 0x1; - } else { - /* Use %rax (register #0) for the scratch register. */ - auprobe->fixups = UPROBE_FIX_RIP_AX; - /* Change modrm from 00 xxx 101 to 00 xxx 000 */ - *cursor = (reg << 3); - } - - /* Target address = address of next instruction + (signed) offset */ - auprobe->rip_rela_target_address = (long)insn->length + insn->displacement.value; - - /* Displacement field is gone; slide immediate field (if any) over. */ - if (insn->immediate.nbytes) { - cursor++; - memmove(cursor, cursor + insn->displacement.nbytes, insn->immediate.nbytes); - } - return; -} - -static int validate_insn_64bits(struct arch_uprobe *auprobe, struct insn *insn) -{ - insn_init(insn, auprobe->insn, true); - - /* Skip good instruction prefixes; reject "bad" ones. */ - insn_get_opcode(insn); - if (is_prefix_bad(insn)) - return -ENOTSUPP; - - if (test_bit(OPCODE1(insn), (unsigned long *)good_insns_64)) - return 0; - - if (insn->opcode.nbytes == 2) { - if (test_bit(OPCODE2(insn), (unsigned long *)good_2byte_insns)) - return 0; - } - return -ENOTSUPP; -} - -static int validate_insn_bits(struct arch_uprobe *auprobe, struct mm_struct *mm, struct insn *insn) -{ - if (mm->context.ia32_compat) - return validate_insn_32bits(auprobe, insn); - return validate_insn_64bits(auprobe, insn); -} -#else /* 32-bit: */ -static void handle_riprel_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, struct insn *insn) -{ - /* No RIP-relative addressing on 32-bit */ -} - -static int validate_insn_bits(struct arch_uprobe *auprobe, struct mm_struct *mm, struct insn *insn) -{ - return validate_insn_32bits(auprobe, insn); -} -#endif /* CONFIG_X86_64 */ - -/** - * arch_uprobe_analyze_insn - instruction analysis including validity and fixups. - * @mm: the probed address space. - * @arch_uprobe: the probepoint information. - * Return 0 on success or a -ve number on error. - */ -int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, struct mm_struct *mm) -{ - int ret; - struct insn insn; - - auprobe->fixups = 0; - ret = validate_insn_bits(auprobe, mm, &insn); - if (ret != 0) - return ret; - - handle_riprel_insn(auprobe, mm, &insn); - prepare_fixups(auprobe, &insn); - - return 0; -} - -#ifdef CONFIG_X86_64 -/* - * If we're emulating a rip-relative instruction, save the contents - * of the scratch register and store the target address in that register. - */ -static void -pre_xol_rip_insn(struct arch_uprobe *auprobe, struct pt_regs *regs, - struct arch_uprobe_task *autask) -{ - if (auprobe->fixups & UPROBE_FIX_RIP_AX) { - autask->saved_scratch_register = regs->ax; - regs->ax = current->utask->vaddr; - regs->ax += auprobe->rip_rela_target_address; - } else if (auprobe->fixups & UPROBE_FIX_RIP_CX) { - autask->saved_scratch_register = regs->cx; - regs->cx = current->utask->vaddr; - regs->cx += auprobe->rip_rela_target_address; - } -} -#else -static void -pre_xol_rip_insn(struct arch_uprobe *auprobe, struct pt_regs *regs, - struct arch_uprobe_task *autask) -{ - /* No RIP-relative addressing on 32-bit */ -} -#endif - -/* - * arch_uprobe_pre_xol - prepare to execute out of line. - * @auprobe: the probepoint information. - * @regs: reflects the saved user state of current task. - */ -int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) -{ - struct arch_uprobe_task *autask; - - autask = ¤t->utask->autask; - autask->saved_trap_nr = current->thread.trap_nr; - current->thread.trap_nr = UPROBE_TRAP_NR; - regs->ip = current->utask->xol_vaddr; - pre_xol_rip_insn(auprobe, regs, autask); - - return 0; -} - -/* - * This function is called by arch_uprobe_post_xol() to adjust the return - * address pushed by a call instruction executed out of line. - */ -static int adjust_ret_addr(unsigned long sp, long correction) -{ - int rasize, ncopied; - long ra = 0; - - if (is_ia32_task()) - rasize = 4; - else - rasize = 8; - - ncopied = copy_from_user(&ra, (void __user *)sp, rasize); - if (unlikely(ncopied)) - return -EFAULT; - - ra += correction; - ncopied = copy_to_user((void __user *)sp, &ra, rasize); - if (unlikely(ncopied)) - return -EFAULT; - - return 0; -} - -#ifdef CONFIG_X86_64 -static bool is_riprel_insn(struct arch_uprobe *auprobe) -{ - return ((auprobe->fixups & (UPROBE_FIX_RIP_AX | UPROBE_FIX_RIP_CX)) != 0); -} - -static void -handle_riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs, long *correction) -{ - if (is_riprel_insn(auprobe)) { - struct arch_uprobe_task *autask; - - autask = ¤t->utask->autask; - if (auprobe->fixups & UPROBE_FIX_RIP_AX) - regs->ax = autask->saved_scratch_register; - else - regs->cx = autask->saved_scratch_register; - - /* - * The original instruction includes a displacement, and so - * is 4 bytes longer than what we've just single-stepped. - * Fall through to handle stuff like "jmpq *...(%rip)" and - * "callq *...(%rip)". - */ - if (correction) - *correction += 4; - } -} -#else -static void -handle_riprel_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs, long *correction) -{ - /* No RIP-relative addressing on 32-bit */ -} -#endif - -/* - * If xol insn itself traps and generates a signal(Say, - * SIGILL/SIGSEGV/etc), then detect the case where a singlestepped - * instruction jumps back to its own address. It is assumed that anything - * like do_page_fault/do_trap/etc sets thread.trap_nr != -1. - * - * arch_uprobe_pre_xol/arch_uprobe_post_xol save/restore thread.trap_nr, - * arch_uprobe_xol_was_trapped() simply checks that ->trap_nr is not equal to - * UPROBE_TRAP_NR == -1 set by arch_uprobe_pre_xol(). - */ -bool arch_uprobe_xol_was_trapped(struct task_struct *t) -{ - if (t->thread.trap_nr != UPROBE_TRAP_NR) - return true; - - return false; -} - -/* - * Called after single-stepping. To avoid the SMP problems that can - * occur when we temporarily put back the original opcode to - * single-step, we single-stepped a copy of the instruction. - * - * This function prepares to resume execution after the single-step. - * We have to fix things up as follows: - * - * Typically, the new ip is relative to the copied instruction. We need - * to make it relative to the original instruction (FIX_IP). Exceptions - * are return instructions and absolute or indirect jump or call instructions. - * - * If the single-stepped instruction was a call, the return address that - * is atop the stack is the address following the copied instruction. We - * need to make it the address following the original instruction (FIX_CALL). - * - * If the original instruction was a rip-relative instruction such as - * "movl %edx,0xnnnn(%rip)", we have instead executed an equivalent - * instruction using a scratch register -- e.g., "movl %edx,(%rax)". - * We need to restore the contents of the scratch register and adjust - * the ip, keeping in mind that the instruction we executed is 4 bytes - * shorter than the original instruction (since we squeezed out the offset - * field). (FIX_RIP_AX or FIX_RIP_CX) - */ -int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) -{ - struct uprobe_task *utask; - long correction; - int result = 0; - - WARN_ON_ONCE(current->thread.trap_nr != UPROBE_TRAP_NR); - - utask = current->utask; - current->thread.trap_nr = utask->autask.saved_trap_nr; - correction = (long)(utask->vaddr - utask->xol_vaddr); - handle_riprel_post_xol(auprobe, regs, &correction); - if (auprobe->fixups & UPROBE_FIX_IP) - regs->ip += correction; - - if (auprobe->fixups & UPROBE_FIX_CALL) - result = adjust_ret_addr(regs->sp, correction); - - return result; -} - -/* callback routine for handling exceptions. */ -int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data) -{ - struct die_args *args = data; - struct pt_regs *regs = args->regs; - int ret = NOTIFY_DONE; - - /* We are only interested in userspace traps */ - if (regs && !user_mode_vm(regs)) - return NOTIFY_DONE; - - switch (val) { - case DIE_INT3: - if (uprobe_pre_sstep_notifier(regs)) - ret = NOTIFY_STOP; - - break; - - case DIE_DEBUG: - if (uprobe_post_sstep_notifier(regs)) - ret = NOTIFY_STOP; - - default: - break; - } - - return ret; -} - -/* - * This function gets called when XOL instruction either gets trapped or - * the thread has a fatal signal, so reset the instruction pointer to its - * probed address. - */ -void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) -{ - struct uprobe_task *utask = current->utask; - - current->thread.trap_nr = utask->autask.saved_trap_nr; - handle_riprel_post_xol(auprobe, regs, NULL); - instruction_pointer_set(regs, utask->vaddr); -} - -/* - * Skip these instructions as per the currently known x86 ISA. - * 0x66* { 0x90 | 0x0f 0x1f | 0x0f 0x19 | 0x87 0xc0 } - */ -bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) -{ - int i; - - for (i = 0; i < MAX_UINSN_BYTES; i++) { - if ((auprobe->insn[i] == 0x66)) - continue; - - if (auprobe->insn[i] == 0x90) - return true; - - if (i == (MAX_UINSN_BYTES - 1)) - break; - - if ((auprobe->insn[i] == 0x0f) && (auprobe->insn[i+1] == 0x1f)) - return true; - - if ((auprobe->insn[i] == 0x0f) && (auprobe->insn[i+1] == 0x19)) - return true; - - if ((auprobe->insn[i] == 0x87) && (auprobe->insn[i+1] == 0xc0)) - return true; - - break; - } - return false; -} diff --git a/trunk/arch/x86/pci/fixup.c b/trunk/arch/x86/pci/fixup.c index af8a224db216..5dd467bd6121 100644 --- a/trunk/arch/x86/pci/fixup.c +++ b/trunk/arch/x86/pci/fixup.c @@ -6,7 +6,6 @@ #include #include #include -#include #include static void __devinit pci_fixup_i450nx(struct pci_dev *d) @@ -349,8 +348,6 @@ static void __devinit pci_fixup_video(struct pci_dev *pdev) if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); - if (!vga_default_device()) - vga_set_default_device(pdev); } } DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, diff --git a/trunk/arch/x86/video/fbdev.c b/trunk/arch/x86/video/fbdev.c index d5644bbe8cba..c5ffb6ac8707 100644 --- a/trunk/arch/x86/video/fbdev.c +++ b/trunk/arch/x86/video/fbdev.c @@ -9,34 +9,24 @@ #include #include #include -#include int fb_is_primary_device(struct fb_info *info) { struct device *device = info->device; struct pci_dev *pci_dev = NULL; - struct pci_dev *default_device = vga_default_device(); struct resource *res = NULL; + int retval = 0; if (device) pci_dev = to_pci_dev(device); - if (!pci_dev) - return 0; - - if (default_device) { - if (pci_dev == default_device) - return 1; - else - return 0; - } - - res = &pci_dev->resource[PCI_ROM_RESOURCE]; + if (pci_dev) + res = &pci_dev->resource[PCI_ROM_RESOURCE]; if (res && res->flags & IORESOURCE_ROM_SHADOW) - return 1; + retval = 1; - return 0; + return retval; } EXPORT_SYMBOL(fb_is_primary_device); MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/bcma/core.c b/trunk/drivers/bcma/core.c index bc6e89212ad3..893f6e0c759f 100644 --- a/trunk/drivers/bcma/core.c +++ b/trunk/drivers/bcma/core.c @@ -30,7 +30,6 @@ void bcma_core_disable(struct bcma_device *core, u32 flags) udelay(10); bcma_awrite32(core, BCMA_RESET_CTL, BCMA_RESET_CTL_RESET); - bcma_aread32(core, BCMA_RESET_CTL); udelay(1); } EXPORT_SYMBOL_GPL(bcma_core_disable); @@ -78,7 +77,7 @@ void bcma_core_set_clockmode(struct bcma_device *core, pr_err("HT force timeout\n"); break; case BCMA_CLKMODE_DYNAMIC: - bcma_set32(core, BCMA_CLKCTLST, ~BCMA_CLKCTLST_FORCEHT); + pr_warn("Dynamic clockmode not supported yet!\n"); break; } } diff --git a/trunk/drivers/bcma/driver_pci.c b/trunk/drivers/bcma/driver_pci.c index 9a96f14c8f47..4d38ae179b48 100644 --- a/trunk/drivers/bcma/driver_pci.c +++ b/trunk/drivers/bcma/driver_pci.c @@ -24,12 +24,14 @@ u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address) return pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_DATA); } +#if 0 static void bcma_pcie_write(struct bcma_drv_pci *pc, u32 address, u32 data) { pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_ADDR, address); pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_ADDR); pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_DATA, data); } +#endif static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u8 phy) { @@ -168,50 +170,13 @@ static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc) tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN); } -static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc) -{ - struct bcma_device *core = pc->core; - u16 val16, core_index; - uint regoff; - - regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET); - core_index = (u16)core->core_index; - - val16 = pcicore_read16(pc, regoff); - if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT) - != core_index) { - val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) | - (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK); - pcicore_write16(pc, regoff, val16); - } -} - -/* Fix MISC config to allow coming out of L2/L3-Ready state w/o PRST */ -/* Needs to happen when coming out of 'standby'/'hibernate' */ -static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) -{ - u16 val16; - uint regoff; - - regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_MISC_CONFIG); - - val16 = pcicore_read16(pc, regoff); - - if (!(val16 & BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST)) { - val16 |= BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST; - pcicore_write16(pc, regoff, val16); - } -} - /************************************************** * Init. **************************************************/ static void __devinit bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) { - bcma_core_pci_fixcfg(pc); bcma_pcicore_serdes_workaround(pc); - bcma_core_pci_config_fixup(pc); } void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc) @@ -259,17 +224,3 @@ int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, return err; } EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl); - -void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend) -{ - u32 w; - - w = bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG); - if (extend) - w |= BCMA_CORE_PCI_ASPMTIMER_EXTEND; - else - w &= ~BCMA_CORE_PCI_ASPMTIMER_EXTEND; - bcma_pcie_write(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG, w); - bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG); -} -EXPORT_SYMBOL_GPL(bcma_core_pci_extend_L1timer); diff --git a/trunk/drivers/bcma/driver_pci_host.c b/trunk/drivers/bcma/driver_pci_host.c index b9a86edfec39..d2097a11c3c7 100644 --- a/trunk/drivers/bcma/driver_pci_host.c +++ b/trunk/drivers/bcma/driver_pci_host.c @@ -119,7 +119,7 @@ static int bcma_extpci_read_config(struct bcma_drv_pci *pc, unsigned int dev, if (unlikely(!addr)) goto out; err = -ENOMEM; - mmio = ioremap_nocache(addr, sizeof(val)); + mmio = ioremap_nocache(addr, len); if (!mmio) goto out; @@ -171,7 +171,7 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev, addr = pc->core->addr + BCMA_CORE_PCI_PCICFG0; addr |= (func << 8); addr |= (off & 0xfc); - mmio = ioremap_nocache(addr, sizeof(val)); + mmio = ioremap_nocache(addr, len); if (!mmio) goto out; } @@ -180,7 +180,7 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev, if (unlikely(!addr)) goto out; err = -ENOMEM; - mmio = ioremap_nocache(addr, sizeof(val)); + mmio = ioremap_nocache(addr, len); if (!mmio) goto out; @@ -491,8 +491,8 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) /* Ok, ready to run, register it to the system. * The following needs change, if we want to port hostmode * to non-MIPS platform. */ - io_map_base = (unsigned long)ioremap_nocache(pc_host->mem_resource.start, - resource_size(&pc_host->mem_resource)); + io_map_base = (unsigned long)ioremap_nocache(BCMA_SOC_PCI_MEM, + 0x04000000); pc_host->pci_controller.io_map_base = io_map_base; set_io_port_base(pc_host->pci_controller.io_map_base); /* Give some time to the PCI controller to configure itself with the new diff --git a/trunk/drivers/bcma/host_pci.c b/trunk/drivers/bcma/host_pci.c index 6c05cf470f96..e3928d68802b 100644 --- a/trunk/drivers/bcma/host_pci.c +++ b/trunk/drivers/bcma/host_pci.c @@ -201,9 +201,6 @@ static int __devinit bcma_host_pci_probe(struct pci_dev *dev, bus->hosttype = BCMA_HOSTTYPE_PCI; bus->ops = &bcma_host_pci_ops; - bus->boardinfo.vendor = bus->host_pci->subsystem_vendor; - bus->boardinfo.type = bus->host_pci->subsystem_device; - /* Register */ err = bcma_bus_register(bus); if (err) @@ -225,7 +222,7 @@ static int __devinit bcma_host_pci_probe(struct pci_dev *dev, return err; } -static void __devexit bcma_host_pci_remove(struct pci_dev *dev) +static void bcma_host_pci_remove(struct pci_dev *dev) { struct bcma_bus *bus = pci_get_drvdata(dev); @@ -280,7 +277,7 @@ static struct pci_driver bcma_pci_bridge_driver = { .name = "bcma-pci-bridge", .id_table = bcma_pci_bridge_tbl, .probe = bcma_host_pci_probe, - .remove = __devexit_p(bcma_host_pci_remove), + .remove = bcma_host_pci_remove, .driver.pm = BCMA_PM_OPS, }; diff --git a/trunk/drivers/bcma/scan.c b/trunk/drivers/bcma/scan.c index 5ed0718fc660..3bea7fe25b20 100644 --- a/trunk/drivers/bcma/scan.c +++ b/trunk/drivers/bcma/scan.c @@ -19,14 +19,7 @@ struct bcma_device_id_name { u16 id; const char *name; }; - -static const struct bcma_device_id_name bcma_arm_device_names[] = { - { BCMA_CORE_ARM_1176, "ARM 1176" }, - { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" }, - { BCMA_CORE_ARM_CM3, "ARM CM3" }, -}; - -static const struct bcma_device_id_name bcma_bcm_device_names[] = { +struct bcma_device_id_name bcma_device_names[] = { { BCMA_CORE_OOB_ROUTER, "OOB Router" }, { BCMA_CORE_INVALID, "Invalid" }, { BCMA_CORE_CHIPCOMMON, "ChipCommon" }, @@ -34,6 +27,7 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = { { BCMA_CORE_SRAM, "SRAM" }, { BCMA_CORE_SDRAM, "SDRAM" }, { BCMA_CORE_PCI, "PCI" }, + { BCMA_CORE_MIPS, "MIPS" }, { BCMA_CORE_ETHERNET, "Fast Ethernet" }, { BCMA_CORE_V90, "V90" }, { BCMA_CORE_USB11_HOSTDEV, "USB 1.1 Hostdev" }, @@ -50,6 +44,7 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = { { BCMA_CORE_PHY_A, "PHY A" }, { BCMA_CORE_PHY_B, "PHY B" }, { BCMA_CORE_PHY_G, "PHY G" }, + { BCMA_CORE_MIPS_3302, "MIPS 3302" }, { BCMA_CORE_USB11_HOST, "USB 1.1 Host" }, { BCMA_CORE_USB11_DEV, "USB 1.1 Device" }, { BCMA_CORE_USB20_HOST, "USB 2.0 Host" }, @@ -63,11 +58,15 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = { { BCMA_CORE_PHY_N, "PHY N" }, { BCMA_CORE_SRAM_CTL, "SRAM Controller" }, { BCMA_CORE_MINI_MACPHY, "Mini MACPHY" }, + { BCMA_CORE_ARM_1176, "ARM 1176" }, + { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" }, { BCMA_CORE_PHY_LP, "PHY LP" }, { BCMA_CORE_PMU, "PMU" }, { BCMA_CORE_PHY_SSN, "PHY SSN" }, { BCMA_CORE_SDIO_DEV, "SDIO Device" }, + { BCMA_CORE_ARM_CM3, "ARM CM3" }, { BCMA_CORE_PHY_HT, "PHY HT" }, + { BCMA_CORE_MIPS_74K, "MIPS 74K" }, { BCMA_CORE_MAC_GBIT, "GBit MAC" }, { BCMA_CORE_DDR12_MEM_CTL, "DDR1/DDR2 Memory Controller" }, { BCMA_CORE_PCIE_RC, "PCIe Root Complex" }, @@ -80,41 +79,16 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = { { BCMA_CORE_SHIM, "SHIM" }, { BCMA_CORE_DEFAULT, "Default" }, }; - -static const struct bcma_device_id_name bcma_mips_device_names[] = { - { BCMA_CORE_MIPS, "MIPS" }, - { BCMA_CORE_MIPS_3302, "MIPS 3302" }, - { BCMA_CORE_MIPS_74K, "MIPS 74K" }, -}; - -static const char *bcma_device_name(const struct bcma_device_id *id) +const char *bcma_device_name(struct bcma_device_id *id) { - const struct bcma_device_id_name *names; - int size, i; - - /* search manufacturer specific names */ - switch (id->manuf) { - case BCMA_MANUF_ARM: - names = bcma_arm_device_names; - size = ARRAY_SIZE(bcma_arm_device_names); - break; - case BCMA_MANUF_BCM: - names = bcma_bcm_device_names; - size = ARRAY_SIZE(bcma_bcm_device_names); - break; - case BCMA_MANUF_MIPS: - names = bcma_mips_device_names; - size = ARRAY_SIZE(bcma_mips_device_names); - break; - default: - return "UNKNOWN"; - } + int i; - for (i = 0; i < size; i++) { - if (names[i].id == id->id) - return names[i].name; + if (id->manuf == BCMA_MANUF_BCM) { + for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) { + if (bcma_device_names[i].id == id->id) + return bcma_device_names[i].name; + } } - return "UNKNOWN"; } diff --git a/trunk/drivers/bcma/sprom.c b/trunk/drivers/bcma/sprom.c index c7f93359acb0..3e2a6002aae6 100644 --- a/trunk/drivers/bcma/sprom.c +++ b/trunk/drivers/bcma/sprom.c @@ -181,22 +181,6 @@ static int bcma_sprom_valid(const u16 *sprom) #define SPEX(_field, _offset, _mask, _shift) \ bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift)) -#define SPEX32(_field, _offset, _mask, _shift) \ - bus->sprom._field = ((((u32)sprom[SPOFF((_offset)+2)] << 16 | \ - sprom[SPOFF(_offset)]) & (_mask)) >> (_shift)) - -#define SPEX_ARRAY8(_field, _offset, _mask, _shift) \ - do { \ - SPEX(_field[0], _offset + 0, _mask, _shift); \ - SPEX(_field[1], _offset + 2, _mask, _shift); \ - SPEX(_field[2], _offset + 4, _mask, _shift); \ - SPEX(_field[3], _offset + 6, _mask, _shift); \ - SPEX(_field[4], _offset + 8, _mask, _shift); \ - SPEX(_field[5], _offset + 10, _mask, _shift); \ - SPEX(_field[6], _offset + 12, _mask, _shift); \ - SPEX(_field[7], _offset + 14, _mask, _shift); \ - } while (0) - static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) { u16 v, o; @@ -259,8 +243,7 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, ~0, 0); SPEX(boardflags2_hi, SSB_SPROM8_BFL2HI, ~0, 0); - SPEX(alpha2[0], SSB_SPROM8_CCODE, 0xff00, 8); - SPEX(alpha2[1], SSB_SPROM8_CCODE, 0x00ff, 0); + SPEX(country_code, SSB_SPROM8_CCODE, ~0, 0); /* Extract cores power info info */ for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) { @@ -315,136 +298,6 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) SSB_SROM8_FEM_TR_ISO_SHIFT); SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G, SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT); - - SPEX(ant_available_a, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_A, - SSB_SPROM8_ANTAVAIL_A_SHIFT); - SPEX(ant_available_bg, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_BG, - SSB_SPROM8_ANTAVAIL_BG_SHIFT); - SPEX(maxpwr_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_MAXP_BG_MASK, 0); - SPEX(itssi_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_ITSSI_BG, - SSB_SPROM8_ITSSI_BG_SHIFT); - SPEX(maxpwr_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_MAXP_A_MASK, 0); - SPEX(itssi_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_ITSSI_A, - SSB_SPROM8_ITSSI_A_SHIFT); - SPEX(maxpwr_ah, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AH_MASK, 0); - SPEX(maxpwr_al, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AL_MASK, - SSB_SPROM8_MAXP_AL_SHIFT); - SPEX(gpio0, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P0, 0); - SPEX(gpio1, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P1, - SSB_SPROM8_GPIOA_P1_SHIFT); - SPEX(gpio2, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P2, 0); - SPEX(gpio3, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P3, - SSB_SPROM8_GPIOB_P3_SHIFT); - SPEX(tri2g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI2G, 0); - SPEX(tri5g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI5G, - SSB_SPROM8_TRI5G_SHIFT); - SPEX(tri5gl, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GL, 0); - SPEX(tri5gh, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GH, - SSB_SPROM8_TRI5GH_SHIFT); - SPEX(rxpo2g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO2G, - SSB_SPROM8_RXPO2G_SHIFT); - SPEX(rxpo5g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO5G, - SSB_SPROM8_RXPO5G_SHIFT); - SPEX(rssismf2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMF2G, 0); - SPEX(rssismc2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMC2G, - SSB_SPROM8_RSSISMC2G_SHIFT); - SPEX(rssisav2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISAV2G, - SSB_SPROM8_RSSISAV2G_SHIFT); - SPEX(bxa2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_BXA2G, - SSB_SPROM8_BXA2G_SHIFT); - SPEX(rssismf5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMF5G, 0); - SPEX(rssismc5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMC5G, - SSB_SPROM8_RSSISMC5G_SHIFT); - SPEX(rssisav5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISAV5G, - SSB_SPROM8_RSSISAV5G_SHIFT); - SPEX(bxa5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_BXA5G, - SSB_SPROM8_BXA5G_SHIFT); - - SPEX(pa0b0, SSB_SPROM8_PA0B0, ~0, 0); - SPEX(pa0b1, SSB_SPROM8_PA0B1, ~0, 0); - SPEX(pa0b2, SSB_SPROM8_PA0B2, ~0, 0); - SPEX(pa1b0, SSB_SPROM8_PA1B0, ~0, 0); - SPEX(pa1b1, SSB_SPROM8_PA1B1, ~0, 0); - SPEX(pa1b2, SSB_SPROM8_PA1B2, ~0, 0); - SPEX(pa1lob0, SSB_SPROM8_PA1LOB0, ~0, 0); - SPEX(pa1lob1, SSB_SPROM8_PA1LOB1, ~0, 0); - SPEX(pa1lob2, SSB_SPROM8_PA1LOB2, ~0, 0); - SPEX(pa1hib0, SSB_SPROM8_PA1HIB0, ~0, 0); - SPEX(pa1hib1, SSB_SPROM8_PA1HIB1, ~0, 0); - SPEX(pa1hib2, SSB_SPROM8_PA1HIB2, ~0, 0); - SPEX(cck2gpo, SSB_SPROM8_CCK2GPO, ~0, 0); - SPEX32(ofdm2gpo, SSB_SPROM8_OFDM2GPO, ~0, 0); - SPEX32(ofdm5glpo, SSB_SPROM8_OFDM5GLPO, ~0, 0); - SPEX32(ofdm5gpo, SSB_SPROM8_OFDM5GPO, ~0, 0); - SPEX32(ofdm5ghpo, SSB_SPROM8_OFDM5GHPO, ~0, 0); - - /* Extract the antenna gain values. */ - SPEX(antenna_gain.a0, SSB_SPROM8_AGAIN01, - SSB_SPROM8_AGAIN0, SSB_SPROM8_AGAIN0_SHIFT); - SPEX(antenna_gain.a1, SSB_SPROM8_AGAIN01, - SSB_SPROM8_AGAIN1, SSB_SPROM8_AGAIN1_SHIFT); - SPEX(antenna_gain.a2, SSB_SPROM8_AGAIN23, - SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT); - SPEX(antenna_gain.a3, SSB_SPROM8_AGAIN23, - SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT); - - SPEX(leddc_on_time, SSB_SPROM8_LEDDC, SSB_SPROM8_LEDDC_ON, - SSB_SPROM8_LEDDC_ON_SHIFT); - SPEX(leddc_off_time, SSB_SPROM8_LEDDC, SSB_SPROM8_LEDDC_OFF, - SSB_SPROM8_LEDDC_OFF_SHIFT); - - SPEX(txchain, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_TXCHAIN, - SSB_SPROM8_TXRXC_TXCHAIN_SHIFT); - SPEX(rxchain, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_RXCHAIN, - SSB_SPROM8_TXRXC_RXCHAIN_SHIFT); - SPEX(antswitch, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_SWITCH, - SSB_SPROM8_TXRXC_SWITCH_SHIFT); - - SPEX(opo, SSB_SPROM8_OFDM2GPO, 0x00ff, 0); - - SPEX_ARRAY8(mcs2gpo, SSB_SPROM8_2G_MCSPO, ~0, 0); - SPEX_ARRAY8(mcs5gpo, SSB_SPROM8_5G_MCSPO, ~0, 0); - SPEX_ARRAY8(mcs5glpo, SSB_SPROM8_5GL_MCSPO, ~0, 0); - SPEX_ARRAY8(mcs5ghpo, SSB_SPROM8_5GH_MCSPO, ~0, 0); - - SPEX(rawtempsense, SSB_SPROM8_RAWTS, SSB_SPROM8_RAWTS_RAWTEMP, - SSB_SPROM8_RAWTS_RAWTEMP_SHIFT); - SPEX(measpower, SSB_SPROM8_RAWTS, SSB_SPROM8_RAWTS_MEASPOWER, - SSB_SPROM8_RAWTS_MEASPOWER_SHIFT); - SPEX(tempsense_slope, SSB_SPROM8_OPT_CORRX, - SSB_SPROM8_OPT_CORRX_TEMP_SLOPE, - SSB_SPROM8_OPT_CORRX_TEMP_SLOPE_SHIFT); - SPEX(tempcorrx, SSB_SPROM8_OPT_CORRX, SSB_SPROM8_OPT_CORRX_TEMPCORRX, - SSB_SPROM8_OPT_CORRX_TEMPCORRX_SHIFT); - SPEX(tempsense_option, SSB_SPROM8_OPT_CORRX, - SSB_SPROM8_OPT_CORRX_TEMP_OPTION, - SSB_SPROM8_OPT_CORRX_TEMP_OPTION_SHIFT); - SPEX(freqoffset_corr, SSB_SPROM8_HWIQ_IQSWP, - SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR, - SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR_SHIFT); - SPEX(iqcal_swp_dis, SSB_SPROM8_HWIQ_IQSWP, - SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP, - SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT); - SPEX(hw_iqcal_en, SSB_SPROM8_HWIQ_IQSWP, SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL, - SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT); - - SPEX(bw40po, SSB_SPROM8_BW40PO, ~0, 0); - SPEX(cddpo, SSB_SPROM8_CDDPO, ~0, 0); - SPEX(stbcpo, SSB_SPROM8_STBCPO, ~0, 0); - SPEX(bwduppo, SSB_SPROM8_BWDUPPO, ~0, 0); - - SPEX(tempthresh, SSB_SPROM8_THERMAL, SSB_SPROM8_THERMAL_TRESH, - SSB_SPROM8_THERMAL_TRESH_SHIFT); - SPEX(tempoffset, SSB_SPROM8_THERMAL, SSB_SPROM8_THERMAL_OFFSET, - SSB_SPROM8_THERMAL_OFFSET_SHIFT); - SPEX(phycal_tempdelta, SSB_SPROM8_TEMPDELTA, - SSB_SPROM8_TEMPDELTA_PHYCAL, - SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT); - SPEX(temps_period, SSB_SPROM8_TEMPDELTA, SSB_SPROM8_TEMPDELTA_PERIOD, - SSB_SPROM8_TEMPDELTA_PERIOD_SHIFT); - SPEX(temps_hysteresis, SSB_SPROM8_TEMPDELTA, - SSB_SPROM8_TEMPDELTA_HYSTERESIS, - SSB_SPROM8_TEMPDELTA_HYSTERESIS_SHIFT); } /* diff --git a/trunk/drivers/bluetooth/ath3k.c b/trunk/drivers/bluetooth/ath3k.c index ad591bd240ec..2812b152d6e9 100644 --- a/trunk/drivers/bluetooth/ath3k.c +++ b/trunk/drivers/bluetooth/ath3k.c @@ -81,9 +81,6 @@ static struct usb_device_id ath3k_table[] = { /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) }, - /* Atheros AR5BBU22 with sflash firmware */ - { USB_DEVICE(0x0489, 0xE03C) }, - { } /* Terminating entry */ }; @@ -102,9 +99,6 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, - /* Atheros AR5BBU22 with sflash firmware */ - { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, - { } /* Terminating entry */ }; diff --git a/trunk/drivers/bluetooth/btmrvl_drv.h b/trunk/drivers/bluetooth/btmrvl_drv.h index 94f2d65131c4..90bda50dc446 100644 --- a/trunk/drivers/bluetooth/btmrvl_drv.h +++ b/trunk/drivers/bluetooth/btmrvl_drv.h @@ -67,7 +67,6 @@ struct btmrvl_adapter { u8 wakeup_tries; wait_queue_head_t cmd_wait_q; u8 cmd_complete; - bool is_suspended; }; struct btmrvl_private { @@ -140,10 +139,8 @@ void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd); -int btmrvl_send_hscfg_cmd(struct btmrvl_private *priv); int btmrvl_enable_ps(struct btmrvl_private *priv); int btmrvl_prepare_command(struct btmrvl_private *priv); -int btmrvl_enable_hs(struct btmrvl_private *priv); #ifdef CONFIG_DEBUG_FS void btmrvl_debugfs_init(struct hci_dev *hdev); diff --git a/trunk/drivers/bluetooth/btmrvl_main.c b/trunk/drivers/bluetooth/btmrvl_main.c index 681ca9d18e12..d1209adc882d 100644 --- a/trunk/drivers/bluetooth/btmrvl_main.c +++ b/trunk/drivers/bluetooth/btmrvl_main.c @@ -200,36 +200,6 @@ int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd) } EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd); -int btmrvl_send_hscfg_cmd(struct btmrvl_private *priv) -{ - struct sk_buff *skb; - struct btmrvl_cmd *cmd; - - skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC); - if (!skb) { - BT_ERR("No free skb"); - return -ENOMEM; - } - - cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd)); - cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF, - BT_CMD_HOST_SLEEP_CONFIG)); - cmd->length = 2; - cmd->data[0] = (priv->btmrvl_dev.gpio_gap & 0xff00) >> 8; - cmd->data[1] = (u8) (priv->btmrvl_dev.gpio_gap & 0x00ff); - - bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; - - skb->dev = (void *) priv->btmrvl_dev.hcidev; - skb_queue_head(&priv->adapter->tx_queue, skb); - - BT_DBG("Queue HSCFG Command, gpio=0x%x, gap=0x%x", cmd->data[0], - cmd->data[1]); - - return 0; -} -EXPORT_SYMBOL_GPL(btmrvl_send_hscfg_cmd); - int btmrvl_enable_ps(struct btmrvl_private *priv) { struct sk_buff *skb; @@ -262,7 +232,7 @@ int btmrvl_enable_ps(struct btmrvl_private *priv) } EXPORT_SYMBOL_GPL(btmrvl_enable_ps); -int btmrvl_enable_hs(struct btmrvl_private *priv) +static int btmrvl_enable_hs(struct btmrvl_private *priv) { struct sk_buff *skb; struct btmrvl_cmd *cmd; @@ -298,15 +268,35 @@ int btmrvl_enable_hs(struct btmrvl_private *priv) return ret; } -EXPORT_SYMBOL_GPL(btmrvl_enable_hs); int btmrvl_prepare_command(struct btmrvl_private *priv) { + struct sk_buff *skb = NULL; + struct btmrvl_cmd *cmd; int ret = 0; if (priv->btmrvl_dev.hscfgcmd) { priv->btmrvl_dev.hscfgcmd = 0; - btmrvl_send_hscfg_cmd(priv); + + skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC); + if (skb == NULL) { + BT_ERR("No free skb"); + return -ENOMEM; + } + + cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd)); + cmd->ocf_ogf = cpu_to_le16(hci_opcode_pack(OGF, BT_CMD_HOST_SLEEP_CONFIG)); + cmd->length = 2; + cmd->data[0] = (priv->btmrvl_dev.gpio_gap & 0xff00) >> 8; + cmd->data[1] = (u8) (priv->btmrvl_dev.gpio_gap & 0x00ff); + + bt_cb(skb)->pkt_type = MRVL_VENDOR_PKT; + + skb->dev = (void *) priv->btmrvl_dev.hcidev; + skb_queue_head(&priv->adapter->tx_queue, skb); + + BT_DBG("Queue HSCFG Command, gpio=0x%x, gap=0x%x", + cmd->data[0], cmd->data[1]); } if (priv->btmrvl_dev.pscmd) { diff --git a/trunk/drivers/bluetooth/btmrvl_sdio.c b/trunk/drivers/bluetooth/btmrvl_sdio.c index a853244e7fd7..27b74b0d547b 100644 --- a/trunk/drivers/bluetooth/btmrvl_sdio.c +++ b/trunk/drivers/bluetooth/btmrvl_sdio.c @@ -339,7 +339,9 @@ static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card *card) done: kfree(tmphlprbuf); - release_firmware(fw_helper); + if (fw_helper) + release_firmware(fw_helper); + return ret; } @@ -482,7 +484,10 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card) done: kfree(tmpfwbuf); - release_firmware(fw_firmware); + + if (fw_firmware) + release_firmware(fw_firmware); + return ret; } @@ -1008,9 +1013,6 @@ static int btmrvl_sdio_probe(struct sdio_func *func, priv->btmrvl_dev.psmode = 1; btmrvl_enable_ps(priv); - priv->btmrvl_dev.gpio_gap = 0xffff; - btmrvl_send_hscfg_cmd(priv); - return 0; disable_host_int: @@ -1046,111 +1048,11 @@ static void btmrvl_sdio_remove(struct sdio_func *func) } } -static int btmrvl_sdio_suspend(struct device *dev) -{ - struct sdio_func *func = dev_to_sdio_func(dev); - struct btmrvl_sdio_card *card; - struct btmrvl_private *priv; - mmc_pm_flag_t pm_flags; - struct hci_dev *hcidev; - - if (func) { - pm_flags = sdio_get_host_pm_caps(func); - BT_DBG("%s: suspend: PM flags = 0x%x", sdio_func_id(func), - pm_flags); - if (!(pm_flags & MMC_PM_KEEP_POWER)) { - BT_ERR("%s: cannot remain alive while suspended", - sdio_func_id(func)); - return -ENOSYS; - } - card = sdio_get_drvdata(func); - if (!card || !card->priv) { - BT_ERR("card or priv structure is not valid"); - return 0; - } - } else { - BT_ERR("sdio_func is not specified"); - return 0; - } - - priv = card->priv; - - if (priv->adapter->hs_state != HS_ACTIVATED) { - if (btmrvl_enable_hs(priv)) { - BT_ERR("HS not actived, suspend failed!"); - return -EBUSY; - } - } - hcidev = priv->btmrvl_dev.hcidev; - BT_DBG("%s: SDIO suspend", hcidev->name); - hci_suspend_dev(hcidev); - skb_queue_purge(&priv->adapter->tx_queue); - - priv->adapter->is_suspended = true; - - /* We will keep the power when hs enabled successfully */ - if (priv->adapter->hs_state == HS_ACTIVATED) { - BT_DBG("suspend with MMC_PM_KEEP_POWER"); - return sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); - } else { - BT_DBG("suspend without MMC_PM_KEEP_POWER"); - return 0; - } -} - -static int btmrvl_sdio_resume(struct device *dev) -{ - struct sdio_func *func = dev_to_sdio_func(dev); - struct btmrvl_sdio_card *card; - struct btmrvl_private *priv; - mmc_pm_flag_t pm_flags; - struct hci_dev *hcidev; - - if (func) { - pm_flags = sdio_get_host_pm_caps(func); - BT_DBG("%s: resume: PM flags = 0x%x", sdio_func_id(func), - pm_flags); - card = sdio_get_drvdata(func); - if (!card || !card->priv) { - BT_ERR("card or priv structure is not valid"); - return 0; - } - } else { - BT_ERR("sdio_func is not specified"); - return 0; - } - priv = card->priv; - - if (!priv->adapter->is_suspended) { - BT_DBG("device already resumed"); - return 0; - } - - priv->adapter->is_suspended = false; - hcidev = priv->btmrvl_dev.hcidev; - BT_DBG("%s: SDIO resume", hcidev->name); - hci_resume_dev(hcidev); - priv->hw_wakeup_firmware(priv); - priv->adapter->hs_state = HS_DEACTIVATED; - BT_DBG("%s: HS DEACTIVATED in resume!", hcidev->name); - - return 0; -} - -static const struct dev_pm_ops btmrvl_sdio_pm_ops = { - .suspend = btmrvl_sdio_suspend, - .resume = btmrvl_sdio_resume, -}; - static struct sdio_driver bt_mrvl_sdio = { .name = "btmrvl_sdio", .id_table = btmrvl_sdio_ids, .probe = btmrvl_sdio_probe, .remove = btmrvl_sdio_remove, - .drv = { - .owner = THIS_MODULE, - .pm = &btmrvl_sdio_pm_ops, - } }; static int __init btmrvl_sdio_init_module(void) diff --git a/trunk/drivers/bluetooth/btusb.c b/trunk/drivers/bluetooth/btusb.c index c9463af8e564..461c68bc4dd7 100644 --- a/trunk/drivers/bluetooth/btusb.c +++ b/trunk/drivers/bluetooth/btusb.c @@ -143,9 +143,6 @@ static struct usb_device_id blacklist_table[] = { /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, - /* Atheros AR5BBU12 with sflash firmware */ - { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, - /* Broadcom BCM2035 */ { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, @@ -858,7 +855,6 @@ static void btusb_work(struct work_struct *work) { struct btusb_data *data = container_of(work, struct btusb_data, work); struct hci_dev *hdev = data->hdev; - int new_alts; int err; if (hdev->conn_hash.sco_num > 0) { @@ -872,19 +868,11 @@ static void btusb_work(struct work_struct *work) set_bit(BTUSB_DID_ISO_RESUME, &data->flags); } - - if (hdev->voice_setting & 0x0020) { - static const int alts[3] = { 2, 4, 5 }; - new_alts = alts[hdev->conn_hash.sco_num - 1]; - } else { - new_alts = hdev->conn_hash.sco_num; - } - - if (data->isoc_altsetting != new_alts) { + if (data->isoc_altsetting != 2) { clear_bit(BTUSB_ISOC_RUNNING, &data->flags); usb_kill_anchored_urbs(&data->isoc_anchor); - if (__set_isoc_interface(hdev, new_alts) < 0) + if (__set_isoc_interface(hdev, 2) < 0) return; } diff --git a/trunk/drivers/bluetooth/hci_ldisc.c b/trunk/drivers/bluetooth/hci_ldisc.c index e564579a6115..98a8c05d4f23 100644 --- a/trunk/drivers/bluetooth/hci_ldisc.c +++ b/trunk/drivers/bluetooth/hci_ldisc.c @@ -388,7 +388,7 @@ static int hci_uart_register_dev(struct hci_uart *hu) hdev->close = hci_uart_close; hdev->flush = hci_uart_flush; hdev->send = hci_uart_send_frame; - SET_HCIDEV_DEV(hdev, hu->tty->dev); + hdev->parent = hu->tty->dev; if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); diff --git a/trunk/drivers/bluetooth/hci_vhci.c b/trunk/drivers/bluetooth/hci_vhci.c index 3f72595a6017..158bfe507da7 100644 --- a/trunk/drivers/bluetooth/hci_vhci.c +++ b/trunk/drivers/bluetooth/hci_vhci.c @@ -252,9 +252,8 @@ static int vhci_open(struct inode *inode, struct file *file) } file->private_data = data; - nonseekable_open(inode, file); - return 0; + return nonseekable_open(inode, file); } static int vhci_release(struct inode *inode, struct file *file) diff --git a/trunk/drivers/char/agp/generic.c b/trunk/drivers/char/agp/generic.c index a0df182f6f7d..17e05d1076b3 100644 --- a/trunk/drivers/char/agp/generic.c +++ b/trunk/drivers/char/agp/generic.c @@ -958,7 +958,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge) if (set_memory_uc((unsigned long)table, 1 << page_order)) printk(KERN_WARNING "Could not set GATT table memory to UC!\n"); - bridge->gatt_table = (u32 __iomem *)table; + bridge->gatt_table = (void *)table; #else bridge->gatt_table = ioremap_nocache(virt_to_phys(table), (PAGE_SIZE * (1 << page_order))); @@ -1010,6 +1010,7 @@ int agp_generic_free_gatt_table(struct agp_bridge_data *bridge) case LVL2_APER_SIZE: /* The generic routines can't deal with 2 level gatt's */ return -EINVAL; + break; default: page_order = 0; break; @@ -1076,6 +1077,7 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) case LVL2_APER_SIZE: /* The generic routines can't deal with 2 level gatt's */ return -EINVAL; + break; default: num_entries = 0; break; diff --git a/trunk/drivers/char/agp/intel-agp.c b/trunk/drivers/char/agp/intel-agp.c index 764f70c5e690..962e75dc4781 100644 --- a/trunk/drivers/char/agp/intel-agp.c +++ b/trunk/drivers/char/agp/intel-agp.c @@ -907,11 +907,6 @@ static struct pci_device_id agp_intel_pci_table[] = { ID(PCI_DEVICE_ID_INTEL_IVYBRIDGE_HB), ID(PCI_DEVICE_ID_INTEL_IVYBRIDGE_M_HB), ID(PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB), - ID(PCI_DEVICE_ID_INTEL_VALLEYVIEW_HB), - ID(PCI_DEVICE_ID_INTEL_HASWELL_HB), - ID(PCI_DEVICE_ID_INTEL_HASWELL_M_HB), - ID(PCI_DEVICE_ID_INTEL_HASWELL_S_HB), - ID(PCI_DEVICE_ID_INTEL_HASWELL_E_HB), { } }; diff --git a/trunk/drivers/char/agp/intel-agp.h b/trunk/drivers/char/agp/intel-agp.h index c0091753a0d1..7ea18a5fe71c 100644 --- a/trunk/drivers/char/agp/intel-agp.h +++ b/trunk/drivers/char/agp/intel-agp.h @@ -96,7 +96,6 @@ #define G4x_GMCH_SIZE_VT_2M (G4x_GMCH_SIZE_2M | G4x_GMCH_SIZE_VT_EN) #define GFX_FLSH_CNTL 0x2170 /* 915+ */ -#define GFX_FLSH_CNTL_VLV 0x101008 #define I810_DRAM_CTL 0x3000 #define I810_DRAM_ROW_0 0x00000001 @@ -236,19 +235,6 @@ #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB 0x0158 /* Server */ #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG 0x015A #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT2_IG 0x016A -#define PCI_DEVICE_ID_INTEL_VALLEYVIEW_HB 0x0F00 /* VLV1 */ -#define PCI_DEVICE_ID_INTEL_VALLEYVIEW_IG 0x0F30 -#define PCI_DEVICE_ID_INTEL_HASWELL_HB 0x0400 /* Desktop */ -#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT1_IG 0x0402 -#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG 0x0412 -#define PCI_DEVICE_ID_INTEL_HASWELL_M_HB 0x0404 /* Mobile */ -#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG 0x0406 -#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG 0x0416 -#define PCI_DEVICE_ID_INTEL_HASWELL_S_HB 0x0408 /* Server */ -#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG 0x040a -#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG 0x041a -#define PCI_DEVICE_ID_INTEL_HASWELL_SDV 0x0c16 /* SDV */ -#define PCI_DEVICE_ID_INTEL_HASWELL_E_HB 0x0c04 int intel_gmch_probe(struct pci_dev *pdev, struct agp_bridge_data *bridge); diff --git a/trunk/drivers/char/agp/intel-gtt.c b/trunk/drivers/char/agp/intel-gtt.c index 1237e7575c3f..7f025fb620de 100644 --- a/trunk/drivers/char/agp/intel-gtt.c +++ b/trunk/drivers/char/agp/intel-gtt.c @@ -1179,20 +1179,6 @@ static void gen6_write_entry(dma_addr_t addr, unsigned int entry, writel(addr | pte_flags, intel_private.gtt + entry); } -static void valleyview_write_entry(dma_addr_t addr, unsigned int entry, - unsigned int flags) -{ - u32 pte_flags; - - pte_flags = GEN6_PTE_UNCACHED | I810_PTE_VALID; - - /* gen6 has bit11-4 for physical addr bit39-32 */ - addr |= (addr >> 28) & 0xff0; - writel(addr | pte_flags, intel_private.gtt + entry); - - writel(1, intel_private.registers + GFX_FLSH_CNTL_VLV); -} - static void gen6_cleanup(void) { } @@ -1219,16 +1205,12 @@ static inline int needs_idle_maps(void) static int i9xx_setup(void) { u32 reg_addr; - int size = KB(512); pci_read_config_dword(intel_private.pcidev, I915_MMADDR, ®_addr); reg_addr &= 0xfff80000; - if (INTEL_GTT_GEN >= 7) - size = MB(2); - - intel_private.registers = ioremap(reg_addr, size); + intel_private.registers = ioremap(reg_addr, 128 * 4096); if (!intel_private.registers) return -ENOMEM; @@ -1372,15 +1354,6 @@ static const struct intel_gtt_driver sandybridge_gtt_driver = { .check_flags = gen6_check_flags, .chipset_flush = i9xx_chipset_flush, }; -static const struct intel_gtt_driver valleyview_gtt_driver = { - .gen = 7, - .setup = i9xx_setup, - .cleanup = gen6_cleanup, - .write_entry = valleyview_write_entry, - .dma_mask_size = 40, - .check_flags = gen6_check_flags, - .chipset_flush = i9xx_chipset_flush, -}; /* Table to describe Intel GMCH and AGP/PCIE GART drivers. At least one of * driver and gmch_driver must be non-null, and find_gmch will determine @@ -1487,22 +1460,6 @@ static const struct intel_gtt_driver_description { "Ivybridge", &sandybridge_gtt_driver }, { PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT2_IG, "Ivybridge", &sandybridge_gtt_driver }, - { PCI_DEVICE_ID_INTEL_VALLEYVIEW_IG, - "ValleyView", &valleyview_gtt_driver }, - { PCI_DEVICE_ID_INTEL_HASWELL_D_GT1_IG, - "Haswell", &sandybridge_gtt_driver }, - { PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG, - "Haswell", &sandybridge_gtt_driver }, - { PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG, - "Haswell", &sandybridge_gtt_driver }, - { PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG, - "Haswell", &sandybridge_gtt_driver }, - { PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG, - "Haswell", &sandybridge_gtt_driver }, - { PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG, - "Haswell", &sandybridge_gtt_driver }, - { PCI_DEVICE_ID_INTEL_HASWELL_SDV, - "Haswell", &sandybridge_gtt_driver }, { 0, NULL, NULL } }; diff --git a/trunk/drivers/char/agp/sgi-agp.c b/trunk/drivers/char/agp/sgi-agp.c index 192000377737..ffa888cd1c88 100644 --- a/trunk/drivers/char/agp/sgi-agp.c +++ b/trunk/drivers/char/agp/sgi-agp.c @@ -158,6 +158,7 @@ static int sgi_tioca_insert_memory(struct agp_memory *mem, off_t pg_start, break; case LVL2_APER_SIZE: return -EINVAL; + break; default: num_entries = 0; break; diff --git a/trunk/drivers/firewire/core-card.c b/trunk/drivers/firewire/core-card.c index 57ea7f464178..f5552b362efc 100644 --- a/trunk/drivers/firewire/core-card.c +++ b/trunk/drivers/firewire/core-card.c @@ -421,8 +421,8 @@ static void bm_work(struct work_struct *work) * root, and thus, IRM. */ new_root_id = local_id; - fw_notice(card, "BM lock failed (%s), making local node (%02x) root\n", - fw_rcode_string(rcode), new_root_id); + fw_notice(card, "%s, making local node (%02x) root\n", + "BM lock failed", new_root_id); goto pick_me; } } else if (card->bm_generation != generation) { diff --git a/trunk/drivers/firewire/core-cdev.c b/trunk/drivers/firewire/core-cdev.c index 2783f69dada6..2e6b24547e2a 100644 --- a/trunk/drivers/firewire/core-cdev.c +++ b/trunk/drivers/firewire/core-cdev.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -71,7 +70,6 @@ struct client { u64 iso_closure; struct fw_iso_buffer buffer; unsigned long vm_start; - bool buffer_is_mapped; struct list_head phy_receiver_link; u64 phy_receiver_closure; @@ -961,20 +959,11 @@ static void iso_mc_callback(struct fw_iso_context *context, sizeof(e->interrupt), NULL, 0); } -static enum dma_data_direction iso_dma_direction(struct fw_iso_context *context) -{ - if (context->type == FW_ISO_CONTEXT_TRANSMIT) - return DMA_TO_DEVICE; - else - return DMA_FROM_DEVICE; -} - static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg) { struct fw_cdev_create_iso_context *a = &arg->create_iso_context; struct fw_iso_context *context; fw_iso_callback_t cb; - int ret; BUILD_BUG_ON(FW_CDEV_ISO_CONTEXT_TRANSMIT != FW_ISO_CONTEXT_TRANSMIT || FW_CDEV_ISO_CONTEXT_RECEIVE != FW_ISO_CONTEXT_RECEIVE || @@ -1015,21 +1004,8 @@ static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg) if (client->iso_context != NULL) { spin_unlock_irq(&client->lock); fw_iso_context_destroy(context); - return -EBUSY; } - if (!client->buffer_is_mapped) { - ret = fw_iso_buffer_map_dma(&client->buffer, - client->device->card, - iso_dma_direction(context)); - if (ret < 0) { - spin_unlock_irq(&client->lock); - fw_iso_context_destroy(context); - - return ret; - } - client->buffer_is_mapped = true; - } client->iso_closure = a->closure; client->iso_context = context; spin_unlock_irq(&client->lock); @@ -1675,6 +1651,7 @@ static long fw_device_op_compat_ioctl(struct file *file, static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) { struct client *client = file->private_data; + enum dma_data_direction direction; unsigned long size; int page_count, ret; @@ -1697,28 +1674,20 @@ static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) if (size & ~PAGE_MASK) return -EINVAL; - ret = fw_iso_buffer_alloc(&client->buffer, page_count); - if (ret < 0) - return ret; + if (vma->vm_flags & VM_WRITE) + direction = DMA_TO_DEVICE; + else + direction = DMA_FROM_DEVICE; - spin_lock_irq(&client->lock); - if (client->iso_context) { - ret = fw_iso_buffer_map_dma(&client->buffer, - client->device->card, - iso_dma_direction(client->iso_context)); - client->buffer_is_mapped = (ret == 0); - } - spin_unlock_irq(&client->lock); + ret = fw_iso_buffer_init(&client->buffer, client->device->card, + page_count, direction); if (ret < 0) - goto fail; + return ret; - ret = fw_iso_buffer_map_vma(&client->buffer, vma); + ret = fw_iso_buffer_map(&client->buffer, vma); if (ret < 0) - goto fail; + fw_iso_buffer_destroy(&client->buffer, client->device->card); - return 0; - fail: - fw_iso_buffer_destroy(&client->buffer, client->device->card); return ret; } diff --git a/trunk/drivers/firewire/core-device.c b/trunk/drivers/firewire/core-device.c index 4d460ef87161..68109e9bb04e 100644 --- a/trunk/drivers/firewire/core-device.c +++ b/trunk/drivers/firewire/core-device.c @@ -481,7 +481,6 @@ static int read_rom(struct fw_device *device, * generation changes under us, read_config_rom will fail and get retried. * It's better to start all over in this case because the node from which we * are reading the ROM may have changed the ROM during the reset. - * Returns either a result code or a negative error code. */ static int read_config_rom(struct fw_device *device, int generation) { @@ -489,7 +488,7 @@ static int read_config_rom(struct fw_device *device, int generation) const u32 *old_rom, *new_rom; u32 *rom, *stack; u32 sp, key; - int i, end, length, ret; + int i, end, length, ret = -1; rom = kmalloc(sizeof(*rom) * MAX_CONFIG_ROM_SIZE + sizeof(*stack) * MAX_CONFIG_ROM_SIZE, GFP_KERNEL); @@ -503,21 +502,18 @@ static int read_config_rom(struct fw_device *device, int generation) /* First read the bus info block. */ for (i = 0; i < 5; i++) { - ret = read_rom(device, generation, i, &rom[i]); - if (ret != RCODE_COMPLETE) + if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; /* - * As per IEEE1212 7.2, during initialization, devices can + * As per IEEE1212 7.2, during power-up, devices can * reply with a 0 for the first quadlet of the config * rom to indicate that they are booting (for example, * if the firmware is on the disk of a external * harddisk). In that case we just fail, and the * retry mechanism will try again later. */ - if (i == 0 && rom[i] == 0) { - ret = RCODE_BUSY; + if (i == 0 && rom[i] == 0) goto out; - } } device->max_speed = device->node->max_speed; @@ -567,14 +563,11 @@ static int read_config_rom(struct fw_device *device, int generation) */ key = stack[--sp]; i = key & 0xffffff; - if (WARN_ON(i >= MAX_CONFIG_ROM_SIZE)) { - ret = -ENXIO; + if (WARN_ON(i >= MAX_CONFIG_ROM_SIZE)) goto out; - } /* Read header quadlet for the block to get the length. */ - ret = read_rom(device, generation, i, &rom[i]); - if (ret != RCODE_COMPLETE) + if (read_rom(device, generation, i, &rom[i]) != RCODE_COMPLETE) goto out; end = i + (rom[i] >> 16) + 1; if (end > MAX_CONFIG_ROM_SIZE) { @@ -597,8 +590,8 @@ static int read_config_rom(struct fw_device *device, int generation) * it references another block, and push it in that case. */ for (; i < end; i++) { - ret = read_rom(device, generation, i, &rom[i]); - if (ret != RCODE_COMPLETE) + if (read_rom(device, generation, i, &rom[i]) != + RCODE_COMPLETE) goto out; if ((key >> 30) != 3 || (rom[i] >> 30) < 2) @@ -626,10 +619,8 @@ static int read_config_rom(struct fw_device *device, int generation) old_rom = device->config_rom; new_rom = kmemdup(rom, length * 4, GFP_KERNEL); - if (new_rom == NULL) { - ret = -ENOMEM; + if (new_rom == NULL) goto out; - } down_write(&fw_device_rwsem); device->config_rom = new_rom; @@ -637,7 +628,7 @@ static int read_config_rom(struct fw_device *device, int generation) up_write(&fw_device_rwsem); kfree(old_rom); - ret = RCODE_COMPLETE; + ret = 0; device->max_rec = rom[2] >> 12 & 0xf; device->cmc = rom[2] >> 30 & 1; device->irmc = rom[2] >> 31 & 1; @@ -976,17 +967,15 @@ static void fw_device_init(struct work_struct *work) * device. */ - ret = read_config_rom(device, device->generation); - if (ret != RCODE_COMPLETE) { + if (read_config_rom(device, device->generation) < 0) { if (device->config_rom_retries < MAX_RETRIES && atomic_read(&device->state) == FW_DEVICE_INITIALIZING) { device->config_rom_retries++; fw_schedule_device_work(device, RETRY_DELAY); } else { if (device->node->link_on) - fw_notice(card, "giving up on node %x: reading config rom failed: %s\n", - device->node_id, - fw_rcode_string(ret)); + fw_notice(card, "giving up on Config ROM for node id %x\n", + device->node_id); if (device->node == card->root_node) fw_schedule_bm_work(card, 0); fw_device_release(&device->device); @@ -1080,30 +1069,31 @@ static void fw_device_init(struct work_struct *work) put_device(&device->device); /* our reference */ } +enum { + REREAD_BIB_ERROR, + REREAD_BIB_GONE, + REREAD_BIB_UNCHANGED, + REREAD_BIB_CHANGED, +}; + /* Reread and compare bus info block and header of root directory */ -static int reread_config_rom(struct fw_device *device, int generation, - bool *changed) +static int reread_config_rom(struct fw_device *device, int generation) { u32 q; - int i, rcode; + int i; for (i = 0; i < 6; i++) { - rcode = read_rom(device, generation, i, &q); - if (rcode != RCODE_COMPLETE) - return rcode; + if (read_rom(device, generation, i, &q) != RCODE_COMPLETE) + return REREAD_BIB_ERROR; if (i == 0 && q == 0) - /* inaccessible (see read_config_rom); retry later */ - return RCODE_BUSY; + return REREAD_BIB_GONE; - if (q != device->config_rom[i]) { - *changed = true; - return RCODE_COMPLETE; - } + if (q != device->config_rom[i]) + return REREAD_BIB_CHANGED; } - *changed = false; - return RCODE_COMPLETE; + return REREAD_BIB_UNCHANGED; } static void fw_device_refresh(struct work_struct *work) @@ -1111,14 +1101,23 @@ static void fw_device_refresh(struct work_struct *work) struct fw_device *device = container_of(work, struct fw_device, work.work); struct fw_card *card = device->card; - int ret, node_id = device->node_id; - bool changed; + int node_id = device->node_id; + + switch (reread_config_rom(device, device->generation)) { + case REREAD_BIB_ERROR: + if (device->config_rom_retries < MAX_RETRIES / 2 && + atomic_read(&device->state) == FW_DEVICE_INITIALIZING) { + device->config_rom_retries++; + fw_schedule_device_work(device, RETRY_DELAY / 2); + + return; + } + goto give_up; - ret = reread_config_rom(device, device->generation, &changed); - if (ret != RCODE_COMPLETE) - goto failed_config_rom; + case REREAD_BIB_GONE: + goto gone; - if (!changed) { + case REREAD_BIB_UNCHANGED: if (atomic_cmpxchg(&device->state, FW_DEVICE_INITIALIZING, FW_DEVICE_RUNNING) == FW_DEVICE_GONE) @@ -1127,6 +1126,9 @@ static void fw_device_refresh(struct work_struct *work) fw_device_update(work); device->config_rom_retries = 0; goto out; + + case REREAD_BIB_CHANGED: + break; } /* @@ -1135,9 +1137,16 @@ static void fw_device_refresh(struct work_struct *work) */ device_for_each_child(&device->device, NULL, shutdown_unit); - ret = read_config_rom(device, device->generation); - if (ret != RCODE_COMPLETE) - goto failed_config_rom; + if (read_config_rom(device, device->generation) < 0) { + if (device->config_rom_retries < MAX_RETRIES && + atomic_read(&device->state) == FW_DEVICE_INITIALIZING) { + device->config_rom_retries++; + fw_schedule_device_work(device, RETRY_DELAY); + + return; + } + goto give_up; + } fw_device_cdev_update(device); create_units(device); @@ -1154,16 +1163,9 @@ static void fw_device_refresh(struct work_struct *work) device->config_rom_retries = 0; goto out; - failed_config_rom: - if (device->config_rom_retries < MAX_RETRIES && - atomic_read(&device->state) == FW_DEVICE_INITIALIZING) { - device->config_rom_retries++; - fw_schedule_device_work(device, RETRY_DELAY); - return; - } - - fw_notice(card, "giving up on refresh of device %s: %s\n", - dev_name(&device->device), fw_rcode_string(ret)); + give_up: + fw_notice(card, "giving up on refresh of device %s\n", + dev_name(&device->device)); gone: atomic_set(&device->state, FW_DEVICE_GONE); PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); diff --git a/trunk/drivers/firewire/core-iso.c b/trunk/drivers/firewire/core-iso.c index 8382e27e9a27..d1565828ae2c 100644 --- a/trunk/drivers/firewire/core-iso.c +++ b/trunk/drivers/firewire/core-iso.c @@ -39,73 +39,52 @@ * Isochronous DMA context management */ -int fw_iso_buffer_alloc(struct fw_iso_buffer *buffer, int page_count) +int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, + int page_count, enum dma_data_direction direction) { - int i; + int i, j; + dma_addr_t address; + + buffer->page_count = page_count; + buffer->direction = direction; - buffer->page_count = 0; - buffer->page_count_mapped = 0; buffer->pages = kmalloc(page_count * sizeof(buffer->pages[0]), GFP_KERNEL); if (buffer->pages == NULL) - return -ENOMEM; + goto out; - for (i = 0; i < page_count; i++) { + for (i = 0; i < buffer->page_count; i++) { buffer->pages[i] = alloc_page(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); if (buffer->pages[i] == NULL) - break; - } - buffer->page_count = i; - if (i < page_count) { - fw_iso_buffer_destroy(buffer, NULL); - return -ENOMEM; - } + goto out_pages; - return 0; -} - -int fw_iso_buffer_map_dma(struct fw_iso_buffer *buffer, struct fw_card *card, - enum dma_data_direction direction) -{ - dma_addr_t address; - int i; - - buffer->direction = direction; - - for (i = 0; i < buffer->page_count; i++) { address = dma_map_page(card->device, buffer->pages[i], 0, PAGE_SIZE, direction); - if (dma_mapping_error(card->device, address)) - break; - + if (dma_mapping_error(card->device, address)) { + __free_page(buffer->pages[i]); + goto out_pages; + } set_page_private(buffer->pages[i], address); } - buffer->page_count_mapped = i; - if (i < buffer->page_count) - return -ENOMEM; return 0; -} - -int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, - int page_count, enum dma_data_direction direction) -{ - int ret; - - ret = fw_iso_buffer_alloc(buffer, page_count); - if (ret < 0) - return ret; - ret = fw_iso_buffer_map_dma(buffer, card, direction); - if (ret < 0) - fw_iso_buffer_destroy(buffer, card); + out_pages: + for (j = 0; j < i; j++) { + address = page_private(buffer->pages[j]); + dma_unmap_page(card->device, address, + PAGE_SIZE, direction); + __free_page(buffer->pages[j]); + } + kfree(buffer->pages); + out: + buffer->pages = NULL; - return ret; + return -ENOMEM; } EXPORT_SYMBOL(fw_iso_buffer_init); -int fw_iso_buffer_map_vma(struct fw_iso_buffer *buffer, - struct vm_area_struct *vma) +int fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma) { unsigned long uaddr; int i, err; @@ -128,18 +107,15 @@ void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, int i; dma_addr_t address; - for (i = 0; i < buffer->page_count_mapped; i++) { + for (i = 0; i < buffer->page_count; i++) { address = page_private(buffer->pages[i]); dma_unmap_page(card->device, address, PAGE_SIZE, buffer->direction); - } - for (i = 0; i < buffer->page_count; i++) __free_page(buffer->pages[i]); + } kfree(buffer->pages); buffer->pages = NULL; - buffer->page_count = 0; - buffer->page_count_mapped = 0; } EXPORT_SYMBOL(fw_iso_buffer_destroy); diff --git a/trunk/drivers/firewire/core-transaction.c b/trunk/drivers/firewire/core-transaction.c index 780708dc6e25..db8a965cf712 100644 --- a/trunk/drivers/firewire/core-transaction.c +++ b/trunk/drivers/firewire/core-transaction.c @@ -1003,32 +1003,6 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) } EXPORT_SYMBOL(fw_core_handle_response); -/** - * fw_rcode_string - convert a firewire result code to an error description - * @rcode: the result code - */ -const char *fw_rcode_string(int rcode) -{ - static const char *const names[] = { - [RCODE_COMPLETE] = "no error", - [RCODE_CONFLICT_ERROR] = "conflict error", - [RCODE_DATA_ERROR] = "data error", - [RCODE_TYPE_ERROR] = "type error", - [RCODE_ADDRESS_ERROR] = "address error", - [RCODE_SEND_ERROR] = "send error", - [RCODE_CANCELLED] = "timeout", - [RCODE_BUSY] = "busy", - [RCODE_GENERATION] = "bus reset", - [RCODE_NO_ACK] = "no ack", - }; - - if ((unsigned int)rcode < ARRAY_SIZE(names) && names[rcode]) - return names[rcode]; - else - return "unknown"; -} -EXPORT_SYMBOL(fw_rcode_string); - static const struct fw_address_region topology_map_region = { .start = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP, .end = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP_END, }; diff --git a/trunk/drivers/firewire/core.h b/trunk/drivers/firewire/core.h index 515a42c786d0..b5a2f6197053 100644 --- a/trunk/drivers/firewire/core.h +++ b/trunk/drivers/firewire/core.h @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -155,11 +154,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event); /* -iso */ -int fw_iso_buffer_alloc(struct fw_iso_buffer *buffer, int page_count); -int fw_iso_buffer_map_dma(struct fw_iso_buffer *buffer, struct fw_card *card, - enum dma_data_direction direction); -int fw_iso_buffer_map_vma(struct fw_iso_buffer *buffer, - struct vm_area_struct *vma); +int fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma); /* -topology */ diff --git a/trunk/drivers/firewire/nosy.c b/trunk/drivers/firewire/nosy.c index 4ebfb2273672..a7c4422a688e 100644 --- a/trunk/drivers/firewire/nosy.c +++ b/trunk/drivers/firewire/nosy.c @@ -693,8 +693,6 @@ static struct pci_device_id pci_table[] __devinitdata = { { } /* Terminating entry */ }; -MODULE_DEVICE_TABLE(pci, pci_table); - static struct pci_driver lynx_pci_driver = { .name = driver_name, .id_table = pci_table, @@ -702,8 +700,22 @@ static struct pci_driver lynx_pci_driver = { .remove = remove_card, }; -module_pci_driver(lynx_pci_driver); - MODULE_AUTHOR("Kristian Hoegsberg"); MODULE_DESCRIPTION("Snoop mode driver for TI pcilynx 1394 controllers"); MODULE_LICENSE("GPL"); +MODULE_DEVICE_TABLE(pci, pci_table); + +static int __init nosy_init(void) +{ + return pci_register_driver(&lynx_pci_driver); +} + +static void __exit nosy_cleanup(void) +{ + pci_unregister_driver(&lynx_pci_driver); + + pr_info("Unloaded %s\n", driver_name); +} + +module_init(nosy_init); +module_exit(nosy_cleanup); diff --git a/trunk/drivers/firewire/ohci.c b/trunk/drivers/firewire/ohci.c index c1af05e834b6..2b5460075a9f 100644 --- a/trunk/drivers/firewire/ohci.c +++ b/trunk/drivers/firewire/ohci.c @@ -1821,8 +1821,9 @@ static void bus_reset_work(struct work_struct *work) { struct fw_ohci *ohci = container_of(work, struct fw_ohci, bus_reset_work); - int self_id_count, generation, new_generation, i, j; - u32 reg; + int self_id_count, i, j, reg; + int generation, new_generation; + unsigned long flags; void *free_rom = NULL; dma_addr_t free_rom_bus = 0; bool is_new_root; @@ -1929,13 +1930,13 @@ static void bus_reset_work(struct work_struct *work) } /* FIXME: Document how the locking works. */ - spin_lock_irq(&ohci->lock); + spin_lock_irqsave(&ohci->lock, flags); ohci->generation = -1; /* prevent AT packet queueing */ context_stop(&ohci->at_request_ctx); context_stop(&ohci->at_response_ctx); - spin_unlock_irq(&ohci->lock); + spin_unlock_irqrestore(&ohci->lock, flags); /* * Per OHCI 1.2 draft, clause 7.2.3.3, hardware may leave unsent @@ -1945,7 +1946,7 @@ static void bus_reset_work(struct work_struct *work) at_context_flush(&ohci->at_request_ctx); at_context_flush(&ohci->at_response_ctx); - spin_lock_irq(&ohci->lock); + spin_lock_irqsave(&ohci->lock, flags); ohci->generation = generation; reg_write(ohci, OHCI1394_IntEventClear, OHCI1394_busReset); @@ -1989,7 +1990,7 @@ static void bus_reset_work(struct work_struct *work) reg_write(ohci, OHCI1394_PhyReqFilterLoSet, ~0); #endif - spin_unlock_irq(&ohci->lock); + spin_unlock_irqrestore(&ohci->lock, flags); if (free_rom) dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, @@ -2401,6 +2402,7 @@ static int ohci_set_config_rom(struct fw_card *card, const __be32 *config_rom, size_t length) { struct fw_ohci *ohci; + unsigned long flags; __be32 *next_config_rom; dma_addr_t uninitialized_var(next_config_rom_bus); @@ -2439,7 +2441,7 @@ static int ohci_set_config_rom(struct fw_card *card, if (next_config_rom == NULL) return -ENOMEM; - spin_lock_irq(&ohci->lock); + spin_lock_irqsave(&ohci->lock, flags); /* * If there is not an already pending config_rom update, @@ -2465,7 +2467,7 @@ static int ohci_set_config_rom(struct fw_card *card, reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); - spin_unlock_irq(&ohci->lock); + spin_unlock_irqrestore(&ohci->lock, flags); /* If we didn't use the DMA allocation, delete it. */ if (next_config_rom != NULL) @@ -2889,9 +2891,10 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, descriptor_callback_t uninitialized_var(callback); u64 *uninitialized_var(channels); u32 *uninitialized_var(mask), uninitialized_var(regs); + unsigned long flags; int index, ret = -EBUSY; - spin_lock_irq(&ohci->lock); + spin_lock_irqsave(&ohci->lock, flags); switch (type) { case FW_ISO_CONTEXT_TRANSMIT: @@ -2935,7 +2938,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, ret = -ENOSYS; } - spin_unlock_irq(&ohci->lock); + spin_unlock_irqrestore(&ohci->lock, flags); if (index < 0) return ERR_PTR(ret); @@ -2961,7 +2964,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, out_with_header: free_page((unsigned long)ctx->header); out: - spin_lock_irq(&ohci->lock); + spin_lock_irqsave(&ohci->lock, flags); switch (type) { case FW_ISO_CONTEXT_RECEIVE: @@ -2974,7 +2977,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, } *mask |= 1 << index; - spin_unlock_irq(&ohci->lock); + spin_unlock_irqrestore(&ohci->lock, flags); return ERR_PTR(ret); } @@ -3786,8 +3789,6 @@ static struct pci_driver fw_ohci_pci_driver = { #endif }; -module_pci_driver(fw_ohci_pci_driver); - MODULE_AUTHOR("Kristian Hoegsberg "); MODULE_DESCRIPTION("Driver for PCI OHCI IEEE1394 controllers"); MODULE_LICENSE("GPL"); @@ -3796,3 +3797,16 @@ MODULE_LICENSE("GPL"); #ifndef CONFIG_IEEE1394_OHCI1394_MODULE MODULE_ALIAS("ohci1394"); #endif + +static int __init fw_ohci_init(void) +{ + return pci_register_driver(&fw_ohci_pci_driver); +} + +static void __exit fw_ohci_cleanup(void) +{ + pci_unregister_driver(&fw_ohci_pci_driver); +} + +module_init(fw_ohci_init); +module_exit(fw_ohci_cleanup); diff --git a/trunk/drivers/firewire/sbp2.c b/trunk/drivers/firewire/sbp2.c index 1162d6b3bf85..b7e65d7eab64 100644 --- a/trunk/drivers/firewire/sbp2.c +++ b/trunk/drivers/firewire/sbp2.c @@ -207,8 +207,9 @@ static const struct device *lu_dev(const struct sbp2_logical_unit *lu) #define SBP2_MAX_CDB_SIZE 16 /* - * The maximum SBP-2 data buffer size is 0xffff. We quadlet-align this - * for compatibility with earlier versions of this driver. + * The default maximum s/g segment size of a FireWire controller is + * usually 0x10000, but SBP-2 only allows 0xffff. Since buffers have to + * be quadlet-aligned, we set the length limit to 0xffff & ~3. */ #define SBP2_MAX_SEG_SIZE 0xfffc @@ -1162,8 +1163,7 @@ static int sbp2_probe(struct device *dev) shost->max_cmd_len = SBP2_MAX_CDB_SIZE; - if (scsi_add_host_with_dma(shost, &unit->device, - device->card->device) < 0) + if (scsi_add_host(shost, &unit->device) < 0) goto fail_shost_put; /* implicit directory ID */ @@ -1295,7 +1295,10 @@ static struct fw_driver sbp2_driver = { static void sbp2_unmap_scatterlist(struct device *card_device, struct sbp2_command_orb *orb) { - scsi_dma_unmap(orb->cmd); + if (scsi_sg_count(orb->cmd)) + dma_unmap_sg(card_device, scsi_sglist(orb->cmd), + scsi_sg_count(orb->cmd), + orb->cmd->sc_data_direction); if (orb->request.misc & cpu_to_be32(COMMAND_ORB_PAGE_TABLE_PRESENT)) dma_unmap_single(card_device, orb->page_table_bus, @@ -1401,8 +1404,9 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb, struct scatterlist *sg = scsi_sglist(orb->cmd); int i, n; - n = scsi_dma_map(orb->cmd); - if (n <= 0) + n = dma_map_sg(device->card->device, sg, scsi_sg_count(orb->cmd), + orb->cmd->sc_data_direction); + if (n == 0) goto fail; /* @@ -1448,7 +1452,8 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb, return 0; fail_page_table: - scsi_dma_unmap(orb->cmd); + dma_unmap_sg(device->card->device, scsi_sglist(orb->cmd), + scsi_sg_count(orb->cmd), orb->cmd->sc_data_direction); fail: return -ENOMEM; } @@ -1529,10 +1534,7 @@ static int sbp2_scsi_slave_alloc(struct scsi_device *sdev) sdev->allow_restart = 1; - /* - * SBP-2 does not require any alignment, but we set it anyway - * for compatibility with earlier versions of this driver. - */ + /* SBP-2 requires quadlet alignment of the data buffers. */ blk_queue_update_dma_alignment(sdev->request_queue, 4 - 1); if (lu->tgt->workarounds & SBP2_WORKAROUND_INQUIRY_36) @@ -1566,6 +1568,8 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev) if (lu->tgt->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS) blk_queue_max_hw_sectors(sdev->request_queue, 128 * 1024 / 512); + blk_queue_max_segment_size(sdev->request_queue, SBP2_MAX_SEG_SIZE); + return 0; } diff --git a/trunk/drivers/gpu/drm/Kconfig b/trunk/drivers/gpu/drm/Kconfig index 23120c00a881..e354bc0b052a 100644 --- a/trunk/drivers/gpu/drm/Kconfig +++ b/trunk/drivers/gpu/drm/Kconfig @@ -186,9 +186,3 @@ source "drivers/gpu/drm/vmwgfx/Kconfig" source "drivers/gpu/drm/gma500/Kconfig" source "drivers/gpu/drm/udl/Kconfig" - -source "drivers/gpu/drm/ast/Kconfig" - -source "drivers/gpu/drm/mgag200/Kconfig" - -source "drivers/gpu/drm/cirrus/Kconfig" diff --git a/trunk/drivers/gpu/drm/Makefile b/trunk/drivers/gpu/drm/Makefile index f65f65ed0ddf..c20da5bda355 100644 --- a/trunk/drivers/gpu/drm/Makefile +++ b/trunk/drivers/gpu/drm/Makefile @@ -34,8 +34,6 @@ obj-$(CONFIG_DRM_RADEON)+= radeon/ obj-$(CONFIG_DRM_MGA) += mga/ obj-$(CONFIG_DRM_I810) += i810/ obj-$(CONFIG_DRM_I915) += i915/ -obj-$(CONFIG_DRM_MGAG200) += mgag200/ -obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/ obj-$(CONFIG_DRM_SIS) += sis/ obj-$(CONFIG_DRM_SAVAGE)+= savage/ obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/ @@ -44,5 +42,4 @@ obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/ obj-$(CONFIG_DRM_EXYNOS) +=exynos/ obj-$(CONFIG_DRM_GMA500) += gma500/ obj-$(CONFIG_DRM_UDL) += udl/ -obj-$(CONFIG_DRM_AST) += ast/ obj-y += i2c/ diff --git a/trunk/drivers/gpu/drm/ast/Kconfig b/trunk/drivers/gpu/drm/ast/Kconfig deleted file mode 100644 index a277b1257888..000000000000 --- a/trunk/drivers/gpu/drm/ast/Kconfig +++ /dev/null @@ -1,16 +0,0 @@ -config DRM_AST - tristate "AST server chips" - depends on DRM && PCI && EXPERIMENTAL - select DRM_TTM - select FB_SYS_COPYAREA - select FB_SYS_FILLRECT - select FB_SYS_IMAGEBLIT - select DRM_KMS_HELPER - select DRM_TTM - help - Say yes for experimental AST GPU driver. Do not enable - this driver without having a working -modesetting, - and a version of AST that knows to fail if KMS - is bound to the driver. These GPUs are commonly found - in server chipsets. - diff --git a/trunk/drivers/gpu/drm/ast/Makefile b/trunk/drivers/gpu/drm/ast/Makefile deleted file mode 100644 index 8df4f284ee24..000000000000 --- a/trunk/drivers/gpu/drm/ast/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# Makefile for the drm device driver. This driver provides support for the -# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. - -ccflags-y := -Iinclude/drm - -ast-y := ast_drv.o ast_main.o ast_mode.o ast_fb.o ast_ttm.o ast_post.o - -obj-$(CONFIG_DRM_AST) := ast.o \ No newline at end of file diff --git a/trunk/drivers/gpu/drm/ast/ast_dram_tables.h b/trunk/drivers/gpu/drm/ast/ast_dram_tables.h deleted file mode 100644 index cc04539c0ff3..000000000000 --- a/trunk/drivers/gpu/drm/ast/ast_dram_tables.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef AST_DRAM_TABLES_H -#define AST_DRAM_TABLES_H - -/* DRAM timing tables */ -struct ast_dramstruct { - u16 index; - u32 data; -}; - -static const struct ast_dramstruct ast2000_dram_table_data[] = { - { 0x0108, 0x00000000 }, - { 0x0120, 0x00004a21 }, - { 0xFF00, 0x00000043 }, - { 0x0000, 0xFFFFFFFF }, - { 0x0004, 0x00000089 }, - { 0x0008, 0x22331353 }, - { 0x000C, 0x0d07000b }, - { 0x0010, 0x11113333 }, - { 0x0020, 0x00110350 }, - { 0x0028, 0x1e0828f0 }, - { 0x0024, 0x00000001 }, - { 0x001C, 0x00000000 }, - { 0x0014, 0x00000003 }, - { 0xFF00, 0x00000043 }, - { 0x0018, 0x00000131 }, - { 0x0014, 0x00000001 }, - { 0xFF00, 0x00000043 }, - { 0x0018, 0x00000031 }, - { 0x0014, 0x00000001 }, - { 0xFF00, 0x00000043 }, - { 0x0028, 0x1e0828f1 }, - { 0x0024, 0x00000003 }, - { 0x002C, 0x1f0f28fb }, - { 0x0030, 0xFFFFFE01 }, - { 0xFFFF, 0xFFFFFFFF } -}; - -static const struct ast_dramstruct ast1100_dram_table_data[] = { - { 0x2000, 0x1688a8a8 }, - { 0x2020, 0x000041f0 }, - { 0xFF00, 0x00000043 }, - { 0x0000, 0xfc600309 }, - { 0x006C, 0x00909090 }, - { 0x0064, 0x00050000 }, - { 0x0004, 0x00000585 }, - { 0x0008, 0x0011030f }, - { 0x0010, 0x22201724 }, - { 0x0018, 0x1e29011a }, - { 0x0020, 0x00c82222 }, - { 0x0014, 0x01001523 }, - { 0x001C, 0x1024010d }, - { 0x0024, 0x00cb2522 }, - { 0x0038, 0xffffff82 }, - { 0x003C, 0x00000000 }, - { 0x0040, 0x00000000 }, - { 0x0044, 0x00000000 }, - { 0x0048, 0x00000000 }, - { 0x004C, 0x00000000 }, - { 0x0050, 0x00000000 }, - { 0x0054, 0x00000000 }, - { 0x0058, 0x00000000 }, - { 0x005C, 0x00000000 }, - { 0x0060, 0x032aa02a }, - { 0x0064, 0x002d3000 }, - { 0x0068, 0x00000000 }, - { 0x0070, 0x00000000 }, - { 0x0074, 0x00000000 }, - { 0x0078, 0x00000000 }, - { 0x007C, 0x00000000 }, - { 0x0034, 0x00000001 }, - { 0xFF00, 0x00000043 }, - { 0x002C, 0x00000732 }, - { 0x0030, 0x00000040 }, - { 0x0028, 0x00000005 }, - { 0x0028, 0x00000007 }, - { 0x0028, 0x00000003 }, - { 0x0028, 0x00000001 }, - { 0x000C, 0x00005a08 }, - { 0x002C, 0x00000632 }, - { 0x0028, 0x00000001 }, - { 0x0030, 0x000003c0 }, - { 0x0028, 0x00000003 }, - { 0x0030, 0x00000040 }, - { 0x0028, 0x00000003 }, - { 0x000C, 0x00005a21 }, - { 0x0034, 0x00007c03 }, - { 0x0120, 0x00004c41 }, - { 0xffff, 0xffffffff }, -}; - -static const struct ast_dramstruct ast2100_dram_table_data[] = { - { 0x2000, 0x1688a8a8 }, - { 0x2020, 0x00004120 }, - { 0xFF00, 0x00000043 }, - { 0x0000, 0xfc600309 }, - { 0x006C, 0x00909090 }, - { 0x0064, 0x00070000 }, - { 0x0004, 0x00000489 }, - { 0x0008, 0x0011030f }, - { 0x0010, 0x32302926 }, - { 0x0018, 0x274c0122 }, - { 0x0020, 0x00ce2222 }, - { 0x0014, 0x01001523 }, - { 0x001C, 0x1024010d }, - { 0x0024, 0x00cb2522 }, - { 0x0038, 0xffffff82 }, - { 0x003C, 0x00000000 }, - { 0x0040, 0x00000000 }, - { 0x0044, 0x00000000 }, - { 0x0048, 0x00000000 }, - { 0x004C, 0x00000000 }, - { 0x0050, 0x00000000 }, - { 0x0054, 0x00000000 }, - { 0x0058, 0x00000000 }, - { 0x005C, 0x00000000 }, - { 0x0060, 0x0f2aa02a }, - { 0x0064, 0x003f3005 }, - { 0x0068, 0x02020202 }, - { 0x0070, 0x00000000 }, - { 0x0074, 0x00000000 }, - { 0x0078, 0x00000000 }, - { 0x007C, 0x00000000 }, - { 0x0034, 0x00000001 }, - { 0xFF00, 0x00000043 }, - { 0x002C, 0x00000942 }, - { 0x0030, 0x00000040 }, - { 0x0028, 0x00000005 }, - { 0x0028, 0x00000007 }, - { 0x0028, 0x00000003 }, - { 0x0028, 0x00000001 }, - { 0x000C, 0x00005a08 }, - { 0x002C, 0x00000842 }, - { 0x0028, 0x00000001 }, - { 0x0030, 0x000003c0 }, - { 0x0028, 0x00000003 }, - { 0x0030, 0x00000040 }, - { 0x0028, 0x00000003 }, - { 0x000C, 0x00005a21 }, - { 0x0034, 0x00007c03 }, - { 0x0120, 0x00005061 }, - { 0xffff, 0xffffffff }, -}; - -#endif diff --git a/trunk/drivers/gpu/drm/ast/ast_drv.c b/trunk/drivers/gpu/drm/ast/ast_drv.c deleted file mode 100644 index d0c4574ef49c..000000000000 --- a/trunk/drivers/gpu/drm/ast/ast_drv.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 2012 Red Hat Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - */ -/* - * Authors: Dave Airlie - */ -#include -#include - -#include "drmP.h" -#include "drm.h" -#include "drm_crtc_helper.h" - -#include "ast_drv.h" - -int ast_modeset = -1; - -MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); -module_param_named(modeset, ast_modeset, int, 0400); - -#define PCI_VENDOR_ASPEED 0x1a03 - -static struct drm_driver driver; - -#define AST_VGA_DEVICE(id, info) { \ - .class = PCI_BASE_CLASS_DISPLAY << 16, \ - .class_mask = 0xff0000, \ - .vendor = PCI_VENDOR_ASPEED, \ - .device = id, \ - .subvendor = PCI_ANY_ID, \ - .subdevice = PCI_ANY_ID, \ - .driver_data = (unsigned long) info } - -static DEFINE_PCI_DEVICE_TABLE(pciidlist) = { - AST_VGA_DEVICE(PCI_CHIP_AST2000, NULL), - AST_VGA_DEVICE(PCI_CHIP_AST2100, NULL), - /* AST_VGA_DEVICE(PCI_CHIP_AST1180, NULL), - don't bind to 1180 for now */ - {0, 0, 0}, -}; - -MODULE_DEVICE_TABLE(pci, pciidlist); - -static int __devinit -ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - return drm_get_pci_dev(pdev, ent, &driver); -} - -static void -ast_pci_remove(struct pci_dev *pdev) -{ - struct drm_device *dev = pci_get_drvdata(pdev); - - drm_put_dev(dev); -} - - - -static int ast_drm_freeze(struct drm_device *dev) -{ - drm_kms_helper_poll_disable(dev); - - pci_save_state(dev->pdev); - - console_lock(); - ast_fbdev_set_suspend(dev, 1); - console_unlock(); - return 0; -} - -static int ast_drm_thaw(struct drm_device *dev) -{ - int error = 0; - - ast_post_gpu(dev); - - drm_mode_config_reset(dev); - mutex_lock(&dev->mode_config.mutex); - drm_helper_resume_force_mode(dev); - mutex_unlock(&dev->mode_config.mutex); - - console_lock(); - ast_fbdev_set_suspend(dev, 0); - console_unlock(); - return error; -} - -static int ast_drm_resume(struct drm_device *dev) -{ - int ret; - - if (pci_enable_device(dev->pdev)) - return -EIO; - - ret = ast_drm_thaw(dev); - if (ret) - return ret; - - drm_kms_helper_poll_enable(dev); - return 0; -} - -static int ast_pm_suspend(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); - int error; - - error = ast_drm_freeze(ddev); - if (error) - return error; - - pci_disable_device(pdev); - pci_set_power_state(pdev, PCI_D3hot); - return 0; -} -static int ast_pm_resume(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); - return ast_drm_resume(ddev); -} - -static int ast_pm_freeze(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); - - if (!ddev || !ddev->dev_private) - return -ENODEV; - return ast_drm_freeze(ddev); - -} - -static int ast_pm_thaw(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); - return ast_drm_thaw(ddev); -} - -static int ast_pm_poweroff(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); - - return ast_drm_freeze(ddev); -} - -static const struct dev_pm_ops ast_pm_ops = { - .suspend = ast_pm_suspend, - .resume = ast_pm_resume, - .freeze = ast_pm_freeze, - .thaw = ast_pm_thaw, - .poweroff = ast_pm_poweroff, - .restore = ast_pm_resume, -}; - -static struct pci_driver ast_pci_driver = { - .name = DRIVER_NAME, - .id_table = pciidlist, - .probe = ast_pci_probe, - .remove = ast_pci_remove, - .driver.pm = &ast_pm_ops, -}; - -static const struct file_operations ast_fops = { - .owner = THIS_MODULE, - .open = drm_open, - .release = drm_release, - .unlocked_ioctl = drm_ioctl, - .mmap = ast_mmap, - .poll = drm_poll, - .fasync = drm_fasync, - .read = drm_read, -}; - -static struct drm_driver driver = { - .driver_features = DRIVER_USE_MTRR | DRIVER_MODESET | DRIVER_GEM, - .dev_priv_size = 0, - - .load = ast_driver_load, - .unload = ast_driver_unload, - - .fops = &ast_fops, - .name = DRIVER_NAME, - .desc = DRIVER_DESC, - .date = DRIVER_DATE, - .major = DRIVER_MAJOR, - .minor = DRIVER_MINOR, - .patchlevel = DRIVER_PATCHLEVEL, - - .gem_init_object = ast_gem_init_object, - .gem_free_object = ast_gem_free_object, - .dumb_create = ast_dumb_create, - .dumb_map_offset = ast_dumb_mmap_offset, - .dumb_destroy = ast_dumb_destroy, - -}; - -static int __init ast_init(void) -{ -#ifdef CONFIG_VGA_CONSOLE - if (vgacon_text_force() && ast_modeset == -1) - return -EINVAL; -#endif - - if (ast_modeset == 0) - return -EINVAL; - return drm_pci_init(&driver, &ast_pci_driver); -} -static void __exit ast_exit(void) -{ - drm_pci_exit(&driver, &ast_pci_driver); -} - -module_init(ast_init); -module_exit(ast_exit); - -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_LICENSE("GPL and additional rights"); - diff --git a/trunk/drivers/gpu/drm/ast/ast_drv.h b/trunk/drivers/gpu/drm/ast/ast_drv.h deleted file mode 100644 index d4af9edcbb97..000000000000 --- a/trunk/drivers/gpu/drm/ast/ast_drv.h +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright 2012 Red Hat Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - */ -/* - * Authors: Dave Airlie - */ -#ifndef __AST_DRV_H__ -#define __AST_DRV_H__ - -#include "drm_fb_helper.h" - -#include "ttm/ttm_bo_api.h" -#include "ttm/ttm_bo_driver.h" -#include "ttm/ttm_placement.h" -#include "ttm/ttm_memory.h" -#include "ttm/ttm_module.h" - -#include -#include - -#define DRIVER_AUTHOR "Dave Airlie" - -#define DRIVER_NAME "ast" -#define DRIVER_DESC "AST" -#define DRIVER_DATE "20120228" - -#define DRIVER_MAJOR 0 -#define DRIVER_MINOR 1 -#define DRIVER_PATCHLEVEL 0 - -#define PCI_CHIP_AST2000 0x2000 -#define PCI_CHIP_AST2100 0x2010 -#define PCI_CHIP_AST1180 0x1180 - - -enum ast_chip { - AST2000, - AST2100, - AST1100, - AST2200, - AST2150, - AST2300, - AST1180, -}; - -#define AST_DRAM_512Mx16 0 -#define AST_DRAM_1Gx16 1 -#define AST_DRAM_512Mx32 2 -#define AST_DRAM_1Gx32 3 -#define AST_DRAM_2Gx16 6 -#define AST_DRAM_4Gx16 7 - -struct ast_fbdev; - -struct ast_private { - struct drm_device *dev; - - void __iomem *regs; - void __iomem *ioregs; - - enum ast_chip chip; - bool vga2_clone; - uint32_t dram_bus_width; - uint32_t dram_type; - uint32_t mclk; - uint32_t vram_size; - - struct ast_fbdev *fbdev; - - int fb_mtrr; - - struct { - struct drm_global_reference mem_global_ref; - struct ttm_bo_global_ref bo_global_ref; - struct ttm_bo_device bdev; - atomic_t validate_sequence; - } ttm; - - struct drm_gem_object *cursor_cache; - uint64_t cursor_cache_gpu_addr; - struct ttm_bo_kmap_obj cache_kmap; - int next_cursor; -}; - -int ast_driver_load(struct drm_device *dev, unsigned long flags); -int ast_driver_unload(struct drm_device *dev); - -struct ast_gem_object; - -#define AST_IO_AR_PORT_WRITE (0x40) -#define AST_IO_MISC_PORT_WRITE (0x42) -#define AST_IO_SEQ_PORT (0x44) -#define AST_DAC_INDEX_READ (0x3c7) -#define AST_IO_DAC_INDEX_WRITE (0x48) -#define AST_IO_DAC_DATA (0x49) -#define AST_IO_GR_PORT (0x4E) -#define AST_IO_CRTC_PORT (0x54) -#define AST_IO_INPUT_STATUS1_READ (0x5A) -#define AST_IO_MISC_PORT_READ (0x4C) - -#define __ast_read(x) \ -static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ -u##x val = 0;\ -val = ioread##x(ast->regs + reg); \ -return val;\ -} - -__ast_read(8); -__ast_read(16); -__ast_read(32) - -#define __ast_io_read(x) \ -static inline u##x ast_io_read##x(struct ast_private *ast, u32 reg) { \ -u##x val = 0;\ -val = ioread##x(ast->ioregs + reg); \ -return val;\ -} - -__ast_io_read(8); -__ast_io_read(16); -__ast_io_read(32); - -#define __ast_write(x) \ -static inline void ast_write##x(struct ast_private *ast, u32 reg, u##x val) {\ - iowrite##x(val, ast->regs + reg);\ - } - -__ast_write(8); -__ast_write(16); -__ast_write(32); - -#define __ast_io_write(x) \ -static inline void ast_io_write##x(struct ast_private *ast, u32 reg, u##x val) {\ - iowrite##x(val, ast->ioregs + reg);\ - } - -__ast_io_write(8); -__ast_io_write(16); -#undef __ast_io_write - -static inline void ast_set_index_reg(struct ast_private *ast, - uint32_t base, uint8_t index, - uint8_t val) -{ - ast_io_write16(ast, base, ((u16)val << 8) | index); -} - -void ast_set_index_reg_mask(struct ast_private *ast, - uint32_t base, uint8_t index, - uint8_t mask, uint8_t val); -uint8_t ast_get_index_reg(struct ast_private *ast, - uint32_t base, uint8_t index); -uint8_t ast_get_index_reg_mask(struct ast_private *ast, - uint32_t base, uint8_t index, uint8_t mask); - -static inline void ast_open_key(struct ast_private *ast) -{ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xA1, 0xFF, 0x04); -} - -#define AST_VIDMEM_SIZE_8M 0x00800000 -#define AST_VIDMEM_SIZE_16M 0x01000000 -#define AST_VIDMEM_SIZE_32M 0x02000000 -#define AST_VIDMEM_SIZE_64M 0x04000000 -#define AST_VIDMEM_SIZE_128M 0x08000000 - -#define AST_VIDMEM_DEFAULT_SIZE AST_VIDMEM_SIZE_8M - -#define AST_MAX_HWC_WIDTH 64 -#define AST_MAX_HWC_HEIGHT 64 - -#define AST_HWC_SIZE (AST_MAX_HWC_WIDTH*AST_MAX_HWC_HEIGHT*2) -#define AST_HWC_SIGNATURE_SIZE 32 - -#define AST_DEFAULT_HWC_NUM 2 -/* define for signature structure */ -#define AST_HWC_SIGNATURE_CHECKSUM 0x00 -#define AST_HWC_SIGNATURE_SizeX 0x04 -#define AST_HWC_SIGNATURE_SizeY 0x08 -#define AST_HWC_SIGNATURE_X 0x0C -#define AST_HWC_SIGNATURE_Y 0x10 -#define AST_HWC_SIGNATURE_HOTSPOTX 0x14 -#define AST_HWC_SIGNATURE_HOTSPOTY 0x18 - - -struct ast_i2c_chan { - struct i2c_adapter adapter; - struct drm_device *dev; - struct i2c_algo_bit_data bit; -}; - -struct ast_connector { - struct drm_connector base; - struct ast_i2c_chan *i2c; -}; - -struct ast_crtc { - struct drm_crtc base; - u8 lut_r[256], lut_g[256], lut_b[256]; - struct drm_gem_object *cursor_bo; - uint64_t cursor_addr; - int cursor_width, cursor_height; - u8 offset_x, offset_y; -}; - -struct ast_encoder { - struct drm_encoder base; -}; - -struct ast_framebuffer { - struct drm_framebuffer base; - struct drm_gem_object *obj; -}; - -struct ast_fbdev { - struct drm_fb_helper helper; - struct ast_framebuffer afb; - struct list_head fbdev_list; - void *sysram; - int size; - struct ttm_bo_kmap_obj mapping; -}; - -#define to_ast_crtc(x) container_of(x, struct ast_crtc, base) -#define to_ast_connector(x) container_of(x, struct ast_connector, base) -#define to_ast_encoder(x) container_of(x, struct ast_encoder, base) -#define to_ast_framebuffer(x) container_of(x, struct ast_framebuffer, base) - -struct ast_vbios_stdtable { - u8 misc; - u8 seq[4]; - u8 crtc[25]; - u8 ar[20]; - u8 gr[9]; -}; - -struct ast_vbios_enhtable { - u32 ht; - u32 hde; - u32 hfp; - u32 hsync; - u32 vt; - u32 vde; - u32 vfp; - u32 vsync; - u32 dclk_index; - u32 flags; - u32 refresh_rate; - u32 refresh_rate_index; - u32 mode_id; -}; - -struct ast_vbios_dclk_info { - u8 param1; - u8 param2; - u8 param3; -}; - -struct ast_vbios_mode_info { - struct ast_vbios_stdtable *std_table; - struct ast_vbios_enhtable *enh_table; -}; - -extern int ast_mode_init(struct drm_device *dev); -extern void ast_mode_fini(struct drm_device *dev); - -int ast_framebuffer_init(struct drm_device *dev, - struct ast_framebuffer *ast_fb, - struct drm_mode_fb_cmd2 *mode_cmd, - struct drm_gem_object *obj); - -int ast_fbdev_init(struct drm_device *dev); -void ast_fbdev_fini(struct drm_device *dev); -void ast_fbdev_set_suspend(struct drm_device *dev, int state); - -struct ast_bo { - struct ttm_buffer_object bo; - struct ttm_placement placement; - struct ttm_bo_kmap_obj kmap; - struct drm_gem_object gem; - u32 placements[3]; - int pin_count; -}; -#define gem_to_ast_bo(gobj) container_of((gobj), struct ast_bo, gem) - -static inline struct ast_bo * -ast_bo(struct ttm_buffer_object *bo) -{ - return container_of(bo, struct ast_bo, bo); -} - - -#define to_ast_obj(x) container_of(x, struct ast_gem_object, base) - -#define AST_MM_ALIGN_SHIFT 4 -#define AST_MM_ALIGN_MASK ((1 << AST_MM_ALIGN_SHIFT) - 1) - -extern int ast_dumb_create(struct drm_file *file, - struct drm_device *dev, - struct drm_mode_create_dumb *args); -extern int ast_dumb_destroy(struct drm_file *file, - struct drm_device *dev, - uint32_t handle); - -extern int ast_gem_init_object(struct drm_gem_object *obj); -extern void ast_gem_free_object(struct drm_gem_object *obj); -extern int ast_dumb_mmap_offset(struct drm_file *file, - struct drm_device *dev, - uint32_t handle, - uint64_t *offset); - -#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) - -int ast_mm_init(struct ast_private *ast); -void ast_mm_fini(struct ast_private *ast); - -int ast_bo_create(struct drm_device *dev, int size, int align, - uint32_t flags, struct ast_bo **pastbo); - -int ast_gem_create(struct drm_device *dev, - u32 size, bool iskernel, - struct drm_gem_object **obj); - -int ast_bo_pin(struct ast_bo *bo, u32 pl_flag, u64 *gpu_addr); -int ast_bo_unpin(struct ast_bo *bo); - -int ast_bo_reserve(struct ast_bo *bo, bool no_wait); -void ast_bo_unreserve(struct ast_bo *bo); -void ast_ttm_placement(struct ast_bo *bo, int domain); -int ast_bo_push_sysram(struct ast_bo *bo); -int ast_mmap(struct file *filp, struct vm_area_struct *vma); - -/* ast post */ -void ast_post_gpu(struct drm_device *dev); -#endif diff --git a/trunk/drivers/gpu/drm/ast/ast_fb.c b/trunk/drivers/gpu/drm/ast/ast_fb.c deleted file mode 100644 index 2fc8e9e860b1..000000000000 --- a/trunk/drivers/gpu/drm/ast/ast_fb.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright 2012 Red Hat Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - */ -/* - * Authors: Dave Airlie - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "drmP.h" -#include "drm.h" -#include "drm_crtc.h" -#include "drm_fb_helper.h" -#include "ast_drv.h" - -static void ast_dirty_update(struct ast_fbdev *afbdev, - int x, int y, int width, int height) -{ - int i; - struct drm_gem_object *obj; - struct ast_bo *bo; - int src_offset, dst_offset; - int bpp = (afbdev->afb.base.bits_per_pixel + 7)/8; - int ret; - bool unmap = false; - - obj = afbdev->afb.obj; - bo = gem_to_ast_bo(obj); - - ret = ast_bo_reserve(bo, true); - if (ret) { - DRM_ERROR("failed to reserve fb bo\n"); - return; - } - - if (!bo->kmap.virtual) { - ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap); - if (ret) { - DRM_ERROR("failed to kmap fb updates\n"); - ast_bo_unreserve(bo); - return; - } - unmap = true; - } - for (i = y; i < y + height; i++) { - /* assume equal stride for now */ - src_offset = dst_offset = i * afbdev->afb.base.pitches[0] + (x * bpp); - memcpy_toio(bo->kmap.virtual + src_offset, afbdev->sysram + src_offset, width * bpp); - - } - if (unmap) - ttm_bo_kunmap(&bo->kmap); - - ast_bo_unreserve(bo); -} - -static void ast_fillrect(struct fb_info *info, - const struct fb_fillrect *rect) -{ - struct ast_fbdev *afbdev = info->par; - sys_fillrect(info, rect); - ast_dirty_update(afbdev, rect->dx, rect->dy, rect->width, - rect->height); -} - -static void ast_copyarea(struct fb_info *info, - const struct fb_copyarea *area) -{ - struct ast_fbdev *afbdev = info->par; - sys_copyarea(info, area); - ast_dirty_update(afbdev, area->dx, area->dy, area->width, - area->height); -} - -static void ast_imageblit(struct fb_info *info, - const struct fb_image *image) -{ - struct ast_fbdev *afbdev = info->par; - sys_imageblit(info, image); - ast_dirty_update(afbdev, image->dx, image->dy, image->width, - image->height); -} - -static struct fb_ops astfb_ops = { - .owner = THIS_MODULE, - .fb_check_var = drm_fb_helper_check_var, - .fb_set_par = drm_fb_helper_set_par, - .fb_fillrect = ast_fillrect, - .fb_copyarea = ast_copyarea, - .fb_imageblit = ast_imageblit, - .fb_pan_display = drm_fb_helper_pan_display, - .fb_blank = drm_fb_helper_blank, - .fb_setcmap = drm_fb_helper_setcmap, - .fb_debug_enter = drm_fb_helper_debug_enter, - .fb_debug_leave = drm_fb_helper_debug_leave, -}; - -static int astfb_create_object(struct ast_fbdev *afbdev, - struct drm_mode_fb_cmd2 *mode_cmd, - struct drm_gem_object **gobj_p) -{ - struct drm_device *dev = afbdev->helper.dev; - u32 bpp, depth; - u32 size; - struct drm_gem_object *gobj; - - int ret = 0; - drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp); - - size = mode_cmd->pitches[0] * mode_cmd->height; - ret = ast_gem_create(dev, size, true, &gobj); - if (ret) - return ret; - - *gobj_p = gobj; - return ret; -} - -static int astfb_create(struct ast_fbdev *afbdev, - struct drm_fb_helper_surface_size *sizes) -{ - struct drm_device *dev = afbdev->helper.dev; - struct drm_mode_fb_cmd2 mode_cmd; - struct drm_framebuffer *fb; - struct fb_info *info; - int size, ret; - struct device *device = &dev->pdev->dev; - void *sysram; - struct drm_gem_object *gobj = NULL; - struct ast_bo *bo = NULL; - mode_cmd.width = sizes->surface_width; - mode_cmd.height = sizes->surface_height; - mode_cmd.pitches[0] = mode_cmd.width * ((sizes->surface_bpp + 7)/8); - - mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, - sizes->surface_depth); - - size = mode_cmd.pitches[0] * mode_cmd.height; - - ret = astfb_create_object(afbdev, &mode_cmd, &gobj); - if (ret) { - DRM_ERROR("failed to create fbcon backing object %d\n", ret); - return ret; - } - bo = gem_to_ast_bo(gobj); - - sysram = vmalloc(size); - if (!sysram) - return -ENOMEM; - - info = framebuffer_alloc(0, device); - if (!info) { - ret = -ENOMEM; - goto out; - } - info->par = afbdev; - - ret = ast_framebuffer_init(dev, &afbdev->afb, &mode_cmd, gobj); - if (ret) - goto out; - - afbdev->sysram = sysram; - afbdev->size = size; - - fb = &afbdev->afb.base; - afbdev->helper.fb = fb; - afbdev->helper.fbdev = info; - - strcpy(info->fix.id, "astdrmfb"); - - info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT; - info->fbops = &astfb_ops; - - ret = fb_alloc_cmap(&info->cmap, 256, 0); - if (ret) { - ret = -ENOMEM; - goto out; - } - - info->apertures = alloc_apertures(1); - if (!info->apertures) { - ret = -ENOMEM; - goto out; - } - info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0); - info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0); - - drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); - drm_fb_helper_fill_var(info, &afbdev->helper, sizes->fb_width, sizes->fb_height); - - info->screen_base = sysram; - info->screen_size = size; - - info->pixmap.flags = FB_PIXMAP_SYSTEM; - - DRM_DEBUG_KMS("allocated %dx%d\n", - fb->width, fb->height); - - return 0; -out: - return ret; -} - -static void ast_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, - u16 blue, int regno) -{ - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); - ast_crtc->lut_r[regno] = red >> 8; - ast_crtc->lut_g[regno] = green >> 8; - ast_crtc->lut_b[regno] = blue >> 8; -} - -static void ast_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, - u16 *blue, int regno) -{ - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); - *red = ast_crtc->lut_r[regno] << 8; - *green = ast_crtc->lut_g[regno] << 8; - *blue = ast_crtc->lut_b[regno] << 8; -} - -static int ast_find_or_create_single(struct drm_fb_helper *helper, - struct drm_fb_helper_surface_size *sizes) -{ - struct ast_fbdev *afbdev = (struct ast_fbdev *)helper; - int new_fb = 0; - int ret; - - if (!helper->fb) { - ret = astfb_create(afbdev, sizes); - if (ret) - return ret; - new_fb = 1; - } - return new_fb; -} - -static struct drm_fb_helper_funcs ast_fb_helper_funcs = { - .gamma_set = ast_fb_gamma_set, - .gamma_get = ast_fb_gamma_get, - .fb_probe = ast_find_or_create_single, -}; - -static void ast_fbdev_destroy(struct drm_device *dev, - struct ast_fbdev *afbdev) -{ - struct fb_info *info; - struct ast_framebuffer *afb = &afbdev->afb; - if (afbdev->helper.fbdev) { - info = afbdev->helper.fbdev; - unregister_framebuffer(info); - if (info->cmap.len) - fb_dealloc_cmap(&info->cmap); - framebuffer_release(info); - } - - if (afb->obj) { - drm_gem_object_unreference_unlocked(afb->obj); - afb->obj = NULL; - } - drm_fb_helper_fini(&afbdev->helper); - - vfree(afbdev->sysram); - drm_framebuffer_cleanup(&afb->base); -} - -int ast_fbdev_init(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - struct ast_fbdev *afbdev; - int ret; - - afbdev = kzalloc(sizeof(struct ast_fbdev), GFP_KERNEL); - if (!afbdev) - return -ENOMEM; - - ast->fbdev = afbdev; - afbdev->helper.funcs = &ast_fb_helper_funcs; - ret = drm_fb_helper_init(dev, &afbdev->helper, - 1, 1); - if (ret) { - kfree(afbdev); - return ret; - } - - drm_fb_helper_single_add_all_connectors(&afbdev->helper); - drm_fb_helper_initial_config(&afbdev->helper, 32); - return 0; -} - -void ast_fbdev_fini(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - - if (!ast->fbdev) - return; - - ast_fbdev_destroy(dev, ast->fbdev); - kfree(ast->fbdev); - ast->fbdev = NULL; -} - -void ast_fbdev_set_suspend(struct drm_device *dev, int state) -{ - struct ast_private *ast = dev->dev_private; - - if (!ast->fbdev) - return; - - fb_set_suspend(ast->fbdev->helper.fbdev, state); -} diff --git a/trunk/drivers/gpu/drm/ast/ast_main.c b/trunk/drivers/gpu/drm/ast/ast_main.c deleted file mode 100644 index 95ae55b8214b..000000000000 --- a/trunk/drivers/gpu/drm/ast/ast_main.c +++ /dev/null @@ -1,527 +0,0 @@ -/* - * Copyright 2012 Red Hat Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - */ -/* - * Authors: Dave Airlie - */ -#include "drmP.h" -#include "ast_drv.h" - - -#include "drm_fb_helper.h" -#include "drm_crtc_helper.h" - -#include "ast_dram_tables.h" - -void ast_set_index_reg_mask(struct ast_private *ast, - uint32_t base, uint8_t index, - uint8_t mask, uint8_t val) -{ - u8 tmp; - ast_io_write8(ast, base, index); - tmp = (ast_io_read8(ast, base + 1) & mask) | val; - ast_set_index_reg(ast, base, index, tmp); -} - -uint8_t ast_get_index_reg(struct ast_private *ast, - uint32_t base, uint8_t index) -{ - uint8_t ret; - ast_io_write8(ast, base, index); - ret = ast_io_read8(ast, base + 1); - return ret; -} - -uint8_t ast_get_index_reg_mask(struct ast_private *ast, - uint32_t base, uint8_t index, uint8_t mask) -{ - uint8_t ret; - ast_io_write8(ast, base, index); - ret = ast_io_read8(ast, base + 1) & mask; - return ret; -} - - -static int ast_detect_chip(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - - if (dev->pdev->device == PCI_CHIP_AST1180) { - ast->chip = AST1100; - DRM_INFO("AST 1180 detected\n"); - } else { - if (dev->pdev->revision >= 0x20) { - ast->chip = AST2300; - DRM_INFO("AST 2300 detected\n"); - } else if (dev->pdev->revision >= 0x10) { - uint32_t data; - ast_write32(ast, 0xf004, 0x1e6e0000); - ast_write32(ast, 0xf000, 0x1); - - data = ast_read32(ast, 0x1207c); - switch (data & 0x0300) { - case 0x0200: - ast->chip = AST1100; - DRM_INFO("AST 1100 detected\n"); - break; - case 0x0100: - ast->chip = AST2200; - DRM_INFO("AST 2200 detected\n"); - break; - case 0x0000: - ast->chip = AST2150; - DRM_INFO("AST 2150 detected\n"); - break; - default: - ast->chip = AST2100; - DRM_INFO("AST 2100 detected\n"); - break; - } - ast->vga2_clone = false; - } else { - ast->chip = 2000; - DRM_INFO("AST 2000 detected\n"); - } - } - return 0; -} - -static int ast_get_dram_info(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - uint32_t data, data2; - uint32_t denum, num, div, ref_pll; - - ast_write32(ast, 0xf004, 0x1e6e0000); - ast_write32(ast, 0xf000, 0x1); - - - ast_write32(ast, 0x10000, 0xfc600309); - - do { - ; - } while (ast_read32(ast, 0x10000) != 0x01); - data = ast_read32(ast, 0x10004); - - if (data & 0x400) - ast->dram_bus_width = 16; - else - ast->dram_bus_width = 32; - - if (ast->chip == AST2300) { - switch (data & 0x03) { - case 0: - ast->dram_type = AST_DRAM_512Mx16; - break; - default: - case 1: - ast->dram_type = AST_DRAM_1Gx16; - break; - case 2: - ast->dram_type = AST_DRAM_2Gx16; - break; - case 3: - ast->dram_type = AST_DRAM_4Gx16; - break; - } - } else { - switch (data & 0x0c) { - case 0: - case 4: - ast->dram_type = AST_DRAM_512Mx16; - break; - case 8: - if (data & 0x40) - ast->dram_type = AST_DRAM_1Gx16; - else - ast->dram_type = AST_DRAM_512Mx32; - break; - case 0xc: - ast->dram_type = AST_DRAM_1Gx32; - break; - } - } - - data = ast_read32(ast, 0x10120); - data2 = ast_read32(ast, 0x10170); - if (data2 & 0x2000) - ref_pll = 14318; - else - ref_pll = 12000; - - denum = data & 0x1f; - num = (data & 0x3fe0) >> 5; - data = (data & 0xc000) >> 14; - switch (data) { - case 3: - div = 0x4; - break; - case 2: - case 1: - div = 0x2; - break; - default: - div = 0x1; - break; - } - ast->mclk = ref_pll * (num + 2) / (denum + 2) * (div * 1000); - return 0; -} - -uint32_t ast_get_max_dclk(struct drm_device *dev, int bpp) -{ - struct ast_private *ast = dev->dev_private; - uint32_t dclk, jreg; - uint32_t dram_bus_width, mclk, dram_bandwidth, actual_dram_bandwidth, dram_efficency = 500; - - dram_bus_width = ast->dram_bus_width; - mclk = ast->mclk; - - if (ast->chip == AST2100 || - ast->chip == AST1100 || - ast->chip == AST2200 || - ast->chip == AST2150 || - ast->dram_bus_width == 16) - dram_efficency = 600; - else if (ast->chip == AST2300) - dram_efficency = 400; - - dram_bandwidth = mclk * dram_bus_width * 2 / 8; - actual_dram_bandwidth = dram_bandwidth * dram_efficency / 1000; - - if (ast->chip == AST1180) - dclk = actual_dram_bandwidth / ((bpp + 1) / 8); - else { - jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); - if ((jreg & 0x08) && (ast->chip == AST2000)) - dclk = actual_dram_bandwidth / ((bpp + 1 + 16) / 8); - else if ((jreg & 0x08) && (bpp == 8)) - dclk = actual_dram_bandwidth / ((bpp + 1 + 24) / 8); - else - dclk = actual_dram_bandwidth / ((bpp + 1) / 8); - } - - if (ast->chip == AST2100 || - ast->chip == AST2200 || - ast->chip == AST2300 || - ast->chip == AST1180) { - if (dclk > 200) - dclk = 200; - } else { - if (dclk > 165) - dclk = 165; - } - - return dclk; -} - -static void ast_user_framebuffer_destroy(struct drm_framebuffer *fb) -{ - struct ast_framebuffer *ast_fb = to_ast_framebuffer(fb); - if (ast_fb->obj) - drm_gem_object_unreference_unlocked(ast_fb->obj); - - drm_framebuffer_cleanup(fb); - kfree(fb); -} - -static int ast_user_framebuffer_create_handle(struct drm_framebuffer *fb, - struct drm_file *file, - unsigned int *handle) -{ - return -EINVAL; -} - -static const struct drm_framebuffer_funcs ast_fb_funcs = { - .destroy = ast_user_framebuffer_destroy, - .create_handle = ast_user_framebuffer_create_handle, -}; - - -int ast_framebuffer_init(struct drm_device *dev, - struct ast_framebuffer *ast_fb, - struct drm_mode_fb_cmd2 *mode_cmd, - struct drm_gem_object *obj) -{ - int ret; - - ret = drm_framebuffer_init(dev, &ast_fb->base, &ast_fb_funcs); - if (ret) { - DRM_ERROR("framebuffer init failed %d\n", ret); - return ret; - } - drm_helper_mode_fill_fb_struct(&ast_fb->base, mode_cmd); - ast_fb->obj = obj; - return 0; -} - -static struct drm_framebuffer * -ast_user_framebuffer_create(struct drm_device *dev, - struct drm_file *filp, - struct drm_mode_fb_cmd2 *mode_cmd) -{ - struct drm_gem_object *obj; - struct ast_framebuffer *ast_fb; - int ret; - - obj = drm_gem_object_lookup(dev, filp, mode_cmd->handles[0]); - if (obj == NULL) - return ERR_PTR(-ENOENT); - - ast_fb = kzalloc(sizeof(*ast_fb), GFP_KERNEL); - if (!ast_fb) { - drm_gem_object_unreference_unlocked(obj); - return ERR_PTR(-ENOMEM); - } - - ret = ast_framebuffer_init(dev, ast_fb, mode_cmd, obj); - if (ret) { - drm_gem_object_unreference_unlocked(obj); - kfree(ast_fb); - return ERR_PTR(ret); - } - return &ast_fb->base; -} - -static const struct drm_mode_config_funcs ast_mode_funcs = { - .fb_create = ast_user_framebuffer_create, -}; - -static u32 ast_get_vram_info(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - u8 jreg; - - ast_open_key(ast); - - jreg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xaa, 0xff); - switch (jreg & 3) { - case 0: return AST_VIDMEM_SIZE_8M; - case 1: return AST_VIDMEM_SIZE_16M; - case 2: return AST_VIDMEM_SIZE_32M; - case 3: return AST_VIDMEM_SIZE_64M; - } - return AST_VIDMEM_DEFAULT_SIZE; -} - -int ast_driver_load(struct drm_device *dev, unsigned long flags) -{ - struct ast_private *ast; - int ret = 0; - - ast = kzalloc(sizeof(struct ast_private), GFP_KERNEL); - if (!ast) - return -ENOMEM; - - dev->dev_private = ast; - ast->dev = dev; - - ast->regs = pci_iomap(dev->pdev, 1, 0); - if (!ast->regs) { - ret = -EIO; - goto out_free; - } - ast->ioregs = pci_iomap(dev->pdev, 2, 0); - if (!ast->ioregs) { - ret = -EIO; - goto out_free; - } - - ast_detect_chip(dev); - - if (ast->chip != AST1180) { - ast_get_dram_info(dev); - ast->vram_size = ast_get_vram_info(dev); - DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size); - } - - ret = ast_mm_init(ast); - if (ret) - goto out_free; - - drm_mode_config_init(dev); - - dev->mode_config.funcs = (void *)&ast_mode_funcs; - dev->mode_config.min_width = 0; - dev->mode_config.min_height = 0; - dev->mode_config.preferred_depth = 24; - dev->mode_config.prefer_shadow = 1; - - if (ast->chip == AST2100 || - ast->chip == AST2200 || - ast->chip == AST2300 || - ast->chip == AST1180) { - dev->mode_config.max_width = 1920; - dev->mode_config.max_height = 2048; - } else { - dev->mode_config.max_width = 1600; - dev->mode_config.max_height = 1200; - } - - ret = ast_mode_init(dev); - if (ret) - goto out_free; - - ret = ast_fbdev_init(dev); - if (ret) - goto out_free; - - return 0; -out_free: - kfree(ast); - dev->dev_private = NULL; - return ret; -} - -int ast_driver_unload(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - - ast_mode_fini(dev); - ast_fbdev_fini(dev); - drm_mode_config_cleanup(dev); - - ast_mm_fini(ast); - pci_iounmap(dev->pdev, ast->ioregs); - pci_iounmap(dev->pdev, ast->regs); - kfree(ast); - return 0; -} - -int ast_gem_create(struct drm_device *dev, - u32 size, bool iskernel, - struct drm_gem_object **obj) -{ - struct ast_bo *astbo; - int ret; - - *obj = NULL; - - size = roundup(size, PAGE_SIZE); - if (size == 0) - return -EINVAL; - - ret = ast_bo_create(dev, size, 0, 0, &astbo); - if (ret) { - if (ret != -ERESTARTSYS) - DRM_ERROR("failed to allocate GEM object\n"); - return ret; - } - *obj = &astbo->gem; - return 0; -} - -int ast_dumb_create(struct drm_file *file, - struct drm_device *dev, - struct drm_mode_create_dumb *args) -{ - int ret; - struct drm_gem_object *gobj; - u32 handle; - - args->pitch = args->width * ((args->bpp + 7) / 8); - args->size = args->pitch * args->height; - - ret = ast_gem_create(dev, args->size, false, - &gobj); - if (ret) - return ret; - - ret = drm_gem_handle_create(file, gobj, &handle); - drm_gem_object_unreference_unlocked(gobj); - if (ret) - return ret; - - args->handle = handle; - return 0; -} - -int ast_dumb_destroy(struct drm_file *file, - struct drm_device *dev, - uint32_t handle) -{ - return drm_gem_handle_delete(file, handle); -} - -int ast_gem_init_object(struct drm_gem_object *obj) -{ - BUG(); - return 0; -} - -void ast_bo_unref(struct ast_bo **bo) -{ - struct ttm_buffer_object *tbo; - - if ((*bo) == NULL) - return; - - tbo = &((*bo)->bo); - ttm_bo_unref(&tbo); - if (tbo == NULL) - *bo = NULL; - -} -void ast_gem_free_object(struct drm_gem_object *obj) -{ - struct ast_bo *ast_bo = gem_to_ast_bo(obj); - - if (!ast_bo) - return; - ast_bo_unref(&ast_bo); -} - - -static inline u64 ast_bo_mmap_offset(struct ast_bo *bo) -{ - return bo->bo.addr_space_offset; -} -int -ast_dumb_mmap_offset(struct drm_file *file, - struct drm_device *dev, - uint32_t handle, - uint64_t *offset) -{ - struct drm_gem_object *obj; - int ret; - struct ast_bo *bo; - - mutex_lock(&dev->struct_mutex); - obj = drm_gem_object_lookup(dev, file, handle); - if (obj == NULL) { - ret = -ENOENT; - goto out_unlock; - } - - bo = gem_to_ast_bo(obj); - *offset = ast_bo_mmap_offset(bo); - - drm_gem_object_unreference(obj); - ret = 0; -out_unlock: - mutex_unlock(&dev->struct_mutex); - return ret; - -} - diff --git a/trunk/drivers/gpu/drm/ast/ast_mode.c b/trunk/drivers/gpu/drm/ast/ast_mode.c deleted file mode 100644 index 65f9d231af14..000000000000 --- a/trunk/drivers/gpu/drm/ast/ast_mode.c +++ /dev/null @@ -1,1160 +0,0 @@ -/* - * Copyright 2012 Red Hat Inc. - * Parts based on xf86-video-ast - * Copyright (c) 2005 ASPEED Technology Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - */ -/* - * Authors: Dave Airlie - */ -#include -#include "drmP.h" -#include "drm_crtc.h" -#include "drm_crtc_helper.h" -#include "ast_drv.h" - -#include "ast_tables.h" - -static struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev); -static void ast_i2c_destroy(struct ast_i2c_chan *i2c); -static int ast_cursor_set(struct drm_crtc *crtc, - struct drm_file *file_priv, - uint32_t handle, - uint32_t width, - uint32_t height); -static int ast_cursor_move(struct drm_crtc *crtc, - int x, int y); - -static inline void ast_load_palette_index(struct ast_private *ast, - u8 index, u8 red, u8 green, - u8 blue) -{ - ast_io_write8(ast, AST_IO_DAC_INDEX_WRITE, index); - ast_io_read8(ast, AST_IO_SEQ_PORT); - ast_io_write8(ast, AST_IO_DAC_DATA, red); - ast_io_read8(ast, AST_IO_SEQ_PORT); - ast_io_write8(ast, AST_IO_DAC_DATA, green); - ast_io_read8(ast, AST_IO_SEQ_PORT); - ast_io_write8(ast, AST_IO_DAC_DATA, blue); - ast_io_read8(ast, AST_IO_SEQ_PORT); -} - -static void ast_crtc_load_lut(struct drm_crtc *crtc) -{ - struct ast_private *ast = crtc->dev->dev_private; - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); - int i; - - if (!crtc->enabled) - return; - - for (i = 0; i < 256; i++) - ast_load_palette_index(ast, i, ast_crtc->lut_r[i], - ast_crtc->lut_g[i], ast_crtc->lut_b[i]); -} - -static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode, - struct ast_vbios_mode_info *vbios_mode) -{ - struct ast_private *ast = crtc->dev->dev_private; - u32 refresh_rate_index = 0, mode_id, color_index, refresh_rate; - u32 hborder, vborder; - - switch (crtc->fb->bits_per_pixel) { - case 8: - vbios_mode->std_table = &vbios_stdtable[VGAModeIndex]; - color_index = VGAModeIndex - 1; - break; - case 16: - vbios_mode->std_table = &vbios_stdtable[HiCModeIndex]; - color_index = HiCModeIndex; - break; - case 24: - case 32: - vbios_mode->std_table = &vbios_stdtable[TrueCModeIndex]; - color_index = TrueCModeIndex; - break; - default: - return false; - } - - switch (crtc->mode.crtc_hdisplay) { - case 640: - vbios_mode->enh_table = &res_640x480[refresh_rate_index]; - break; - case 800: - vbios_mode->enh_table = &res_800x600[refresh_rate_index]; - break; - case 1024: - vbios_mode->enh_table = &res_1024x768[refresh_rate_index]; - break; - case 1280: - if (crtc->mode.crtc_vdisplay == 800) - vbios_mode->enh_table = &res_1280x800[refresh_rate_index]; - else - vbios_mode->enh_table = &res_1280x1024[refresh_rate_index]; - break; - case 1440: - vbios_mode->enh_table = &res_1440x900[refresh_rate_index]; - break; - case 1600: - vbios_mode->enh_table = &res_1600x1200[refresh_rate_index]; - break; - case 1680: - vbios_mode->enh_table = &res_1680x1050[refresh_rate_index]; - break; - case 1920: - if (crtc->mode.crtc_vdisplay == 1080) - vbios_mode->enh_table = &res_1920x1080[refresh_rate_index]; - else - vbios_mode->enh_table = &res_1920x1200[refresh_rate_index]; - break; - default: - return false; - } - - refresh_rate = drm_mode_vrefresh(mode); - while (vbios_mode->enh_table->refresh_rate < refresh_rate) { - vbios_mode->enh_table++; - if ((vbios_mode->enh_table->refresh_rate > refresh_rate) || - (vbios_mode->enh_table->refresh_rate == 0xff)) { - vbios_mode->enh_table--; - break; - } - } - - hborder = (vbios_mode->enh_table->flags & HBorder) ? 8 : 0; - vborder = (vbios_mode->enh_table->flags & VBorder) ? 8 : 0; - - adjusted_mode->crtc_htotal = vbios_mode->enh_table->ht; - adjusted_mode->crtc_hblank_start = vbios_mode->enh_table->hde + hborder; - adjusted_mode->crtc_hblank_end = vbios_mode->enh_table->ht - hborder; - adjusted_mode->crtc_hsync_start = vbios_mode->enh_table->hde + hborder + - vbios_mode->enh_table->hfp; - adjusted_mode->crtc_hsync_end = (vbios_mode->enh_table->hde + hborder + - vbios_mode->enh_table->hfp + - vbios_mode->enh_table->hsync); - - adjusted_mode->crtc_vtotal = vbios_mode->enh_table->vt; - adjusted_mode->crtc_vblank_start = vbios_mode->enh_table->vde + vborder; - adjusted_mode->crtc_vblank_end = vbios_mode->enh_table->vt - vborder; - adjusted_mode->crtc_vsync_start = vbios_mode->enh_table->vde + vborder + - vbios_mode->enh_table->vfp; - adjusted_mode->crtc_vsync_end = (vbios_mode->enh_table->vde + vborder + - vbios_mode->enh_table->vfp + - vbios_mode->enh_table->vsync); - - refresh_rate_index = vbios_mode->enh_table->refresh_rate_index; - mode_id = vbios_mode->enh_table->mode_id; - - if (ast->chip == AST1180) { - /* TODO 1180 */ - } else { - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8c, (u8)((color_index & 0xf) << 4)); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8d, refresh_rate_index & 0xff); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x8e, mode_id & 0xff); - - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x91, 0xa8); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x92, crtc->fb->bits_per_pixel); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x93, adjusted_mode->clock / 1000); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x94, adjusted_mode->crtc_hdisplay); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x95, adjusted_mode->crtc_hdisplay >> 8); - - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x96, adjusted_mode->crtc_vdisplay); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x97, adjusted_mode->crtc_vdisplay >> 8); - } - - return true; - - -} -static void ast_set_std_reg(struct drm_crtc *crtc, struct drm_display_mode *mode, - struct ast_vbios_mode_info *vbios_mode) -{ - struct ast_private *ast = crtc->dev->dev_private; - struct ast_vbios_stdtable *stdtable; - u32 i; - u8 jreg; - - stdtable = vbios_mode->std_table; - - jreg = stdtable->misc; - ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg); - - /* Set SEQ */ - ast_set_index_reg(ast, AST_IO_SEQ_PORT, 0x00, 0x03); - for (i = 0; i < 4; i++) { - jreg = stdtable->seq[i]; - if (!i) - jreg |= 0x20; - ast_set_index_reg(ast, AST_IO_SEQ_PORT, (i + 1) , jreg); - } - - /* Set CRTC */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00); - for (i = 0; i < 25; i++) - ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, stdtable->crtc[i]); - - /* set AR */ - jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); - for (i = 0; i < 20; i++) { - jreg = stdtable->ar[i]; - ast_io_write8(ast, AST_IO_AR_PORT_WRITE, (u8)i); - ast_io_write8(ast, AST_IO_AR_PORT_WRITE, jreg); - } - ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x14); - ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x00); - - jreg = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); - ast_io_write8(ast, AST_IO_AR_PORT_WRITE, 0x20); - - /* Set GR */ - for (i = 0; i < 9; i++) - ast_set_index_reg(ast, AST_IO_GR_PORT, i, stdtable->gr[i]); -} - -static void ast_set_crtc_reg(struct drm_crtc *crtc, struct drm_display_mode *mode, - struct ast_vbios_mode_info *vbios_mode) -{ - struct ast_private *ast = crtc->dev->dev_private; - u8 jreg05 = 0, jreg07 = 0, jreg09 = 0, jregAC = 0, jregAD = 0, jregAE = 0; - u16 temp; - - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x00); - - temp = (mode->crtc_htotal >> 3) - 5; - if (temp & 0x100) - jregAC |= 0x01; /* HT D[8] */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x00, 0x00, temp); - - temp = (mode->crtc_hdisplay >> 3) - 1; - if (temp & 0x100) - jregAC |= 0x04; /* HDE D[8] */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x01, 0x00, temp); - - temp = (mode->crtc_hblank_start >> 3) - 1; - if (temp & 0x100) - jregAC |= 0x10; /* HBS D[8] */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x02, 0x00, temp); - - temp = ((mode->crtc_hblank_end >> 3) - 1) & 0x7f; - if (temp & 0x20) - jreg05 |= 0x80; /* HBE D[5] */ - if (temp & 0x40) - jregAD |= 0x01; /* HBE D[5] */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x03, 0xE0, (temp & 0x1f)); - - temp = (mode->crtc_hsync_start >> 3) - 1; - if (temp & 0x100) - jregAC |= 0x40; /* HRS D[5] */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x04, 0x00, temp); - - temp = ((mode->crtc_hsync_end >> 3) - 1) & 0x3f; - if (temp & 0x20) - jregAD |= 0x04; /* HRE D[5] */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x05, 0x60, (u8)((temp & 0x1f) | jreg05)); - - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAC, 0x00, jregAC); - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAD, 0x00, jregAD); - - /* vert timings */ - temp = (mode->crtc_vtotal) - 2; - if (temp & 0x100) - jreg07 |= 0x01; - if (temp & 0x200) - jreg07 |= 0x20; - if (temp & 0x400) - jregAE |= 0x01; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x06, 0x00, temp); - - temp = (mode->crtc_vsync_start) - 1; - if (temp & 0x100) - jreg07 |= 0x04; - if (temp & 0x200) - jreg07 |= 0x80; - if (temp & 0x400) - jregAE |= 0x08; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x10, 0x00, temp); - - temp = (mode->crtc_vsync_end - 1) & 0x3f; - if (temp & 0x10) - jregAE |= 0x20; - if (temp & 0x20) - jregAE |= 0x40; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x70, temp & 0xf); - - temp = mode->crtc_vdisplay - 1; - if (temp & 0x100) - jreg07 |= 0x02; - if (temp & 0x200) - jreg07 |= 0x40; - if (temp & 0x400) - jregAE |= 0x02; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x12, 0x00, temp); - - temp = mode->crtc_vblank_start - 1; - if (temp & 0x100) - jreg07 |= 0x08; - if (temp & 0x200) - jreg09 |= 0x20; - if (temp & 0x400) - jregAE |= 0x04; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x15, 0x00, temp); - - temp = mode->crtc_vblank_end - 1; - if (temp & 0x100) - jregAE |= 0x10; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x16, 0x00, temp); - - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x07, 0x00, jreg07); - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x09, 0xdf, jreg09); - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xAE, 0x00, (jregAE | 0x80)); - - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x11, 0x7f, 0x80); -} - -static void ast_set_offset_reg(struct drm_crtc *crtc) -{ - struct ast_private *ast = crtc->dev->dev_private; - - u16 offset; - - offset = crtc->fb->pitches[0] >> 3; - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x13, (offset & 0xff)); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xb0, (offset >> 8) & 0x3f); -} - -static void ast_set_dclk_reg(struct drm_device *dev, struct drm_display_mode *mode, - struct ast_vbios_mode_info *vbios_mode) -{ - struct ast_private *ast = dev->dev_private; - struct ast_vbios_dclk_info *clk_info; - - clk_info = &dclk_table[vbios_mode->enh_table->dclk_index]; - - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc0, 0x00, clk_info->param1); - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xc1, 0x00, clk_info->param2); - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xbb, 0x0f, - (clk_info->param3 & 0x80) | ((clk_info->param3 & 0x3) << 4)); -} - -static void ast_set_ext_reg(struct drm_crtc *crtc, struct drm_display_mode *mode, - struct ast_vbios_mode_info *vbios_mode) -{ - struct ast_private *ast = crtc->dev->dev_private; - u8 jregA0 = 0, jregA3 = 0, jregA8 = 0; - - switch (crtc->fb->bits_per_pixel) { - case 8: - jregA0 = 0x70; - jregA3 = 0x01; - jregA8 = 0x00; - break; - case 15: - case 16: - jregA0 = 0x70; - jregA3 = 0x04; - jregA8 = 0x02; - break; - case 32: - jregA0 = 0x70; - jregA3 = 0x08; - jregA8 = 0x02; - break; - } - - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa0, 0x8f, jregA0); - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xf0, jregA3); - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa8, 0xfd, jregA8); - - /* Set Threshold */ - if (ast->chip == AST2300) { - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x78); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x60); - } else if (ast->chip == AST2100 || - ast->chip == AST1100 || - ast->chip == AST2200 || - ast->chip == AST2150) { - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x3f); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x2f); - } else { - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa7, 0x2f); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa6, 0x1f); - } -} - -void ast_set_sync_reg(struct drm_device *dev, struct drm_display_mode *mode, - struct ast_vbios_mode_info *vbios_mode) -{ - struct ast_private *ast = dev->dev_private; - u8 jreg; - - jreg = ast_io_read8(ast, AST_IO_MISC_PORT_READ); - jreg |= (vbios_mode->enh_table->flags & SyncNN); - ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, jreg); -} - -bool ast_set_dac_reg(struct drm_crtc *crtc, struct drm_display_mode *mode, - struct ast_vbios_mode_info *vbios_mode) -{ - switch (crtc->fb->bits_per_pixel) { - case 8: - break; - default: - return false; - } - return true; -} - -void ast_set_start_address_crt1(struct drm_crtc *crtc, unsigned offset) -{ - struct ast_private *ast = crtc->dev->dev_private; - u32 addr; - - addr = offset >> 2; - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0d, (u8)(addr & 0xff)); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x0c, (u8)((addr >> 8) & 0xff)); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xaf, (u8)((addr >> 16) & 0xff)); - -} - -static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) -{ - struct ast_private *ast = crtc->dev->dev_private; - - if (ast->chip == AST1180) - return; - - switch (mode) { - case DRM_MODE_DPMS_ON: - case DRM_MODE_DPMS_STANDBY: - case DRM_MODE_DPMS_SUSPEND: - ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0); - ast_crtc_load_lut(crtc); - break; - case DRM_MODE_DPMS_OFF: - ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0x20); - break; - } -} - -static bool ast_crtc_mode_fixup(struct drm_crtc *crtc, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - return true; -} - -/* ast is different - we will force move buffers out of VRAM */ -static int ast_crtc_do_set_base(struct drm_crtc *crtc, - struct drm_framebuffer *fb, - int x, int y, int atomic) -{ - struct ast_private *ast = crtc->dev->dev_private; - struct drm_gem_object *obj; - struct ast_framebuffer *ast_fb; - struct ast_bo *bo; - int ret; - u64 gpu_addr; - - /* push the previous fb to system ram */ - if (!atomic && fb) { - ast_fb = to_ast_framebuffer(fb); - obj = ast_fb->obj; - bo = gem_to_ast_bo(obj); - ret = ast_bo_reserve(bo, false); - if (ret) - return ret; - ast_bo_push_sysram(bo); - ast_bo_unreserve(bo); - } - - ast_fb = to_ast_framebuffer(crtc->fb); - obj = ast_fb->obj; - bo = gem_to_ast_bo(obj); - - ret = ast_bo_reserve(bo, false); - if (ret) - return ret; - - ret = ast_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr); - if (ret) { - ast_bo_unreserve(bo); - return ret; - } - - if (&ast->fbdev->afb == ast_fb) { - /* if pushing console in kmap it */ - ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap); - if (ret) - DRM_ERROR("failed to kmap fbcon\n"); - } - ast_bo_unreserve(bo); - - ast_set_start_address_crt1(crtc, (u32)gpu_addr); - - return 0; -} - -static int ast_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, - struct drm_framebuffer *old_fb) -{ - return ast_crtc_do_set_base(crtc, old_fb, x, y, 0); -} - -static int ast_crtc_mode_set(struct drm_crtc *crtc, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode, - int x, int y, - struct drm_framebuffer *old_fb) -{ - struct drm_device *dev = crtc->dev; - struct ast_private *ast = crtc->dev->dev_private; - struct ast_vbios_mode_info vbios_mode; - bool ret; - if (ast->chip == AST1180) { - DRM_ERROR("AST 1180 modesetting not supported\n"); - return -EINVAL; - } - - ret = ast_get_vbios_mode_info(crtc, mode, adjusted_mode, &vbios_mode); - if (ret == false) - return -EINVAL; - ast_open_key(ast); - - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04); - - ast_set_std_reg(crtc, adjusted_mode, &vbios_mode); - ast_set_crtc_reg(crtc, adjusted_mode, &vbios_mode); - ast_set_offset_reg(crtc); - ast_set_dclk_reg(dev, adjusted_mode, &vbios_mode); - ast_set_ext_reg(crtc, adjusted_mode, &vbios_mode); - ast_set_sync_reg(dev, adjusted_mode, &vbios_mode); - ast_set_dac_reg(crtc, adjusted_mode, &vbios_mode); - - ast_crtc_mode_set_base(crtc, x, y, old_fb); - - return 0; -} - -static void ast_crtc_disable(struct drm_crtc *crtc) -{ - -} - -static void ast_crtc_prepare(struct drm_crtc *crtc) -{ - -} - -static void ast_crtc_commit(struct drm_crtc *crtc) -{ - struct ast_private *ast = crtc->dev->dev_private; - ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0); -} - - -static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = { - .dpms = ast_crtc_dpms, - .mode_fixup = ast_crtc_mode_fixup, - .mode_set = ast_crtc_mode_set, - .mode_set_base = ast_crtc_mode_set_base, - .disable = ast_crtc_disable, - .load_lut = ast_crtc_load_lut, - .disable = ast_crtc_disable, - .prepare = ast_crtc_prepare, - .commit = ast_crtc_commit, - -}; - -static void ast_crtc_reset(struct drm_crtc *crtc) -{ - -} - -static void ast_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, - u16 *blue, uint32_t start, uint32_t size) -{ - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); - int end = (start + size > 256) ? 256 : start + size, i; - - /* userspace palettes are always correct as is */ - for (i = start; i < end; i++) { - ast_crtc->lut_r[i] = red[i] >> 8; - ast_crtc->lut_g[i] = green[i] >> 8; - ast_crtc->lut_b[i] = blue[i] >> 8; - } - ast_crtc_load_lut(crtc); -} - - -static void ast_crtc_destroy(struct drm_crtc *crtc) -{ - drm_crtc_cleanup(crtc); - kfree(crtc); -} - -static const struct drm_crtc_funcs ast_crtc_funcs = { - .cursor_set = ast_cursor_set, - .cursor_move = ast_cursor_move, - .reset = ast_crtc_reset, - .set_config = drm_crtc_helper_set_config, - .gamma_set = ast_crtc_gamma_set, - .destroy = ast_crtc_destroy, -}; - -int ast_crtc_init(struct drm_device *dev) -{ - struct ast_crtc *crtc; - int i; - - crtc = kzalloc(sizeof(struct ast_crtc), GFP_KERNEL); - if (!crtc) - return -ENOMEM; - - drm_crtc_init(dev, &crtc->base, &ast_crtc_funcs); - drm_mode_crtc_set_gamma_size(&crtc->base, 256); - drm_crtc_helper_add(&crtc->base, &ast_crtc_helper_funcs); - - for (i = 0; i < 256; i++) { - crtc->lut_r[i] = i; - crtc->lut_g[i] = i; - crtc->lut_b[i] = i; - } - return 0; -} - -static void ast_encoder_destroy(struct drm_encoder *encoder) -{ - drm_encoder_cleanup(encoder); - kfree(encoder); -} - - -static struct drm_encoder *ast_best_single_encoder(struct drm_connector *connector) -{ - int enc_id = connector->encoder_ids[0]; - struct drm_mode_object *obj; - struct drm_encoder *encoder; - - /* pick the encoder ids */ - if (enc_id) { - obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER); - if (!obj) - return NULL; - encoder = obj_to_encoder(obj); - return encoder; - } - return NULL; -} - - -static const struct drm_encoder_funcs ast_enc_funcs = { - .destroy = ast_encoder_destroy, -}; - -static void ast_encoder_dpms(struct drm_encoder *encoder, int mode) -{ - -} - -static bool ast_mode_fixup(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - return true; -} - -static void ast_encoder_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ -} - -static void ast_encoder_prepare(struct drm_encoder *encoder) -{ - -} - -static void ast_encoder_commit(struct drm_encoder *encoder) -{ - -} - - -static const struct drm_encoder_helper_funcs ast_enc_helper_funcs = { - .dpms = ast_encoder_dpms, - .mode_fixup = ast_mode_fixup, - .prepare = ast_encoder_prepare, - .commit = ast_encoder_commit, - .mode_set = ast_encoder_mode_set, -}; - -int ast_encoder_init(struct drm_device *dev) -{ - struct ast_encoder *ast_encoder; - - ast_encoder = kzalloc(sizeof(struct ast_encoder), GFP_KERNEL); - if (!ast_encoder) - return -ENOMEM; - - drm_encoder_init(dev, &ast_encoder->base, &ast_enc_funcs, - DRM_MODE_ENCODER_DAC); - drm_encoder_helper_add(&ast_encoder->base, &ast_enc_helper_funcs); - - ast_encoder->base.possible_crtcs = 1; - return 0; -} - -static int ast_get_modes(struct drm_connector *connector) -{ - struct ast_connector *ast_connector = to_ast_connector(connector); - struct edid *edid; - int ret; - - edid = drm_get_edid(connector, &ast_connector->i2c->adapter); - if (edid) { - drm_mode_connector_update_edid_property(&ast_connector->base, edid); - ret = drm_add_edid_modes(connector, edid); - return ret; - } else - drm_mode_connector_update_edid_property(&ast_connector->base, NULL); - return 0; -} - -static int ast_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) -{ - return MODE_OK; -} - -static void ast_connector_destroy(struct drm_connector *connector) -{ - struct ast_connector *ast_connector = to_ast_connector(connector); - ast_i2c_destroy(ast_connector->i2c); - drm_sysfs_connector_remove(connector); - drm_connector_cleanup(connector); - kfree(connector); -} - -static enum drm_connector_status -ast_connector_detect(struct drm_connector *connector, bool force) -{ - return connector_status_connected; -} - -static const struct drm_connector_helper_funcs ast_connector_helper_funcs = { - .mode_valid = ast_mode_valid, - .get_modes = ast_get_modes, - .best_encoder = ast_best_single_encoder, -}; - -static const struct drm_connector_funcs ast_connector_funcs = { - .dpms = drm_helper_connector_dpms, - .detect = ast_connector_detect, - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = ast_connector_destroy, -}; - -int ast_connector_init(struct drm_device *dev) -{ - struct ast_connector *ast_connector; - struct drm_connector *connector; - struct drm_encoder *encoder; - - ast_connector = kzalloc(sizeof(struct ast_connector), GFP_KERNEL); - if (!ast_connector) - return -ENOMEM; - - connector = &ast_connector->base; - drm_connector_init(dev, connector, &ast_connector_funcs, DRM_MODE_CONNECTOR_VGA); - - drm_connector_helper_add(connector, &ast_connector_helper_funcs); - - connector->interlace_allowed = 0; - connector->doublescan_allowed = 0; - - drm_sysfs_connector_add(connector); - - connector->polled = DRM_CONNECTOR_POLL_CONNECT; - - encoder = list_first_entry(&dev->mode_config.encoder_list, struct drm_encoder, head); - drm_mode_connector_attach_encoder(connector, encoder); - - ast_connector->i2c = ast_i2c_create(dev); - if (!ast_connector->i2c) - DRM_ERROR("failed to add ddc bus for connector\n"); - - return 0; -} - -/* allocate cursor cache and pin at start of VRAM */ -int ast_cursor_init(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - int size; - int ret; - struct drm_gem_object *obj; - struct ast_bo *bo; - uint64_t gpu_addr; - - size = (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE) * AST_DEFAULT_HWC_NUM; - - ret = ast_gem_create(dev, size, true, &obj); - if (ret) - return ret; - bo = gem_to_ast_bo(obj); - ret = ast_bo_reserve(bo, false); - if (unlikely(ret != 0)) - goto fail; - - ret = ast_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr); - ast_bo_unreserve(bo); - if (ret) - goto fail; - - /* kmap the object */ - ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &ast->cache_kmap); - if (ret) - goto fail; - - ast->cursor_cache = obj; - ast->cursor_cache_gpu_addr = gpu_addr; - DRM_ERROR("pinned cursor cache at %llx\n", ast->cursor_cache_gpu_addr); - return 0; -fail: - return ret; -} - -void ast_cursor_fini(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - ttm_bo_kunmap(&ast->cache_kmap); - drm_gem_object_unreference_unlocked(ast->cursor_cache); -} - -int ast_mode_init(struct drm_device *dev) -{ - ast_cursor_init(dev); - ast_crtc_init(dev); - ast_encoder_init(dev); - ast_connector_init(dev); - return 0; -} - -void ast_mode_fini(struct drm_device *dev) -{ - ast_cursor_fini(dev); -} - -static int get_clock(void *i2c_priv) -{ - struct ast_i2c_chan *i2c = i2c_priv; - struct ast_private *ast = i2c->dev->dev_private; - uint32_t val; - - val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4; - return val & 1 ? 1 : 0; -} - -static int get_data(void *i2c_priv) -{ - struct ast_i2c_chan *i2c = i2c_priv; - struct ast_private *ast = i2c->dev->dev_private; - uint32_t val; - - val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5; - return val & 1 ? 1 : 0; -} - -static void set_clock(void *i2c_priv, int clock) -{ - struct ast_i2c_chan *i2c = i2c_priv; - struct ast_private *ast = i2c->dev->dev_private; - int i; - u8 ujcrb7, jtemp; - - for (i = 0; i < 0x10000; i++) { - ujcrb7 = ((clock & 0x01) ? 0 : 1); - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfe, ujcrb7); - jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x01); - if (ujcrb7 == jtemp) - break; - } -} - -static void set_data(void *i2c_priv, int data) -{ - struct ast_i2c_chan *i2c = i2c_priv; - struct ast_private *ast = i2c->dev->dev_private; - int i; - u8 ujcrb7, jtemp; - - for (i = 0; i < 0x10000; i++) { - ujcrb7 = ((data & 0x01) ? 0 : 1) << 2; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfb, ujcrb7); - jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x04); - if (ujcrb7 == jtemp) - break; - } -} - -static struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev) -{ - struct ast_i2c_chan *i2c; - int ret; - - i2c = kzalloc(sizeof(struct ast_i2c_chan), GFP_KERNEL); - if (!i2c) - return NULL; - - i2c->adapter.owner = THIS_MODULE; - i2c->adapter.class = I2C_CLASS_DDC; - i2c->adapter.dev.parent = &dev->pdev->dev; - i2c->dev = dev; - i2c_set_adapdata(&i2c->adapter, i2c); - snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), - "AST i2c bit bus"); - i2c->adapter.algo_data = &i2c->bit; - - i2c->bit.udelay = 20; - i2c->bit.timeout = 2; - i2c->bit.data = i2c; - i2c->bit.setsda = set_data; - i2c->bit.setscl = set_clock; - i2c->bit.getsda = get_data; - i2c->bit.getscl = get_clock; - ret = i2c_bit_add_bus(&i2c->adapter); - if (ret) { - DRM_ERROR("Failed to register bit i2c\n"); - goto out_free; - } - - return i2c; -out_free: - kfree(i2c); - return NULL; -} - -static void ast_i2c_destroy(struct ast_i2c_chan *i2c) -{ - if (!i2c) - return; - i2c_del_adapter(&i2c->adapter); - kfree(i2c); -} - -void ast_show_cursor(struct drm_crtc *crtc) -{ - struct ast_private *ast = crtc->dev->dev_private; - u8 jreg; - - jreg = 0x2; - /* enable ARGB cursor */ - jreg |= 1; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, jreg); -} - -void ast_hide_cursor(struct drm_crtc *crtc) -{ - struct ast_private *ast = crtc->dev->dev_private; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, 0x00); -} - -static u32 copy_cursor_image(u8 *src, u8 *dst, int width, int height) -{ - union { - u32 ul; - u8 b[4]; - } srcdata32[2], data32; - union { - u16 us; - u8 b[2]; - } data16; - u32 csum = 0; - s32 alpha_dst_delta, last_alpha_dst_delta; - u8 *srcxor, *dstxor; - int i, j; - u32 per_pixel_copy, two_pixel_copy; - - alpha_dst_delta = AST_MAX_HWC_WIDTH << 1; - last_alpha_dst_delta = alpha_dst_delta - (width << 1); - - srcxor = src; - dstxor = (u8 *)dst + last_alpha_dst_delta + (AST_MAX_HWC_HEIGHT - height) * alpha_dst_delta; - per_pixel_copy = width & 1; - two_pixel_copy = width >> 1; - - for (j = 0; j < height; j++) { - for (i = 0; i < two_pixel_copy; i++) { - srcdata32[0].ul = *((u32 *)srcxor) & 0xf0f0f0f0; - srcdata32[1].ul = *((u32 *)(srcxor + 4)) & 0xf0f0f0f0; - data32.b[0] = srcdata32[0].b[1] | (srcdata32[0].b[0] >> 4); - data32.b[1] = srcdata32[0].b[3] | (srcdata32[0].b[2] >> 4); - data32.b[2] = srcdata32[0].b[1] | (srcdata32[1].b[0] >> 4); - data32.b[3] = srcdata32[0].b[3] | (srcdata32[1].b[2] >> 4); - - writel(data32.ul, dstxor); - csum += data32.ul; - - dstxor += 4; - srcxor += 8; - - } - - for (i = 0; i < per_pixel_copy; i++) { - srcdata32[0].ul = *((u32 *)srcxor) & 0xf0f0f0f0; - data16.b[0] = srcdata32[0].b[1] | (srcdata32[0].b[0] >> 4); - data16.b[1] = srcdata32[0].b[3] | (srcdata32[0].b[2] >> 4); - writew(data16.us, dstxor); - csum += (u32)data16.us; - - dstxor += 2; - srcxor += 4; - } - dstxor += last_alpha_dst_delta; - } - return csum; -} - -static int ast_cursor_set(struct drm_crtc *crtc, - struct drm_file *file_priv, - uint32_t handle, - uint32_t width, - uint32_t height) -{ - struct ast_private *ast = crtc->dev->dev_private; - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); - struct drm_gem_object *obj; - struct ast_bo *bo; - uint64_t gpu_addr; - u32 csum; - int ret; - struct ttm_bo_kmap_obj uobj_map; - u8 *src, *dst; - bool src_isiomem, dst_isiomem; - if (!handle) { - ast_hide_cursor(crtc); - return 0; - } - - if (width > AST_MAX_HWC_WIDTH || height > AST_MAX_HWC_HEIGHT) - return -EINVAL; - - obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); - if (!obj) { - DRM_ERROR("Cannot find cursor object %x for crtc\n", handle); - return -ENOENT; - } - bo = gem_to_ast_bo(obj); - - ret = ast_bo_reserve(bo, false); - if (ret) - goto fail; - - ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &uobj_map); - - src = ttm_kmap_obj_virtual(&uobj_map, &src_isiomem); - dst = ttm_kmap_obj_virtual(&ast->cache_kmap, &dst_isiomem); - - if (src_isiomem == true) - DRM_ERROR("src cursor bo should be in main memory\n"); - if (dst_isiomem == false) - DRM_ERROR("dst bo should be in VRAM\n"); - - dst += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor; - - /* do data transfer to cursor cache */ - csum = copy_cursor_image(src, dst, width, height); - - /* write checksum + signature */ - ttm_bo_kunmap(&uobj_map); - ast_bo_unreserve(bo); - { - u8 *dst = (u8 *)ast->cache_kmap.virtual + (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor + AST_HWC_SIZE; - writel(csum, dst); - writel(width, dst + AST_HWC_SIGNATURE_SizeX); - writel(height, dst + AST_HWC_SIGNATURE_SizeY); - writel(0, dst + AST_HWC_SIGNATURE_HOTSPOTX); - writel(0, dst + AST_HWC_SIGNATURE_HOTSPOTY); - - /* set pattern offset */ - gpu_addr = ast->cursor_cache_gpu_addr; - gpu_addr += (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor; - gpu_addr >>= 3; - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc8, gpu_addr & 0xff); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc9, (gpu_addr >> 8) & 0xff); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xca, (gpu_addr >> 16) & 0xff); - } - ast_crtc->cursor_width = width; - ast_crtc->cursor_height = height; - ast_crtc->offset_x = AST_MAX_HWC_WIDTH - width; - ast_crtc->offset_y = AST_MAX_HWC_WIDTH - height; - - ast->next_cursor = (ast->next_cursor + 1) % AST_DEFAULT_HWC_NUM; - - ast_show_cursor(crtc); - - drm_gem_object_unreference_unlocked(obj); - return 0; -fail: - drm_gem_object_unreference_unlocked(obj); - return ret; -} - -static int ast_cursor_move(struct drm_crtc *crtc, - int x, int y) -{ - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); - struct ast_private *ast = crtc->dev->dev_private; - int x_offset, y_offset; - u8 *sig; - - sig = (u8 *)ast->cache_kmap.virtual + (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE)*ast->next_cursor + AST_HWC_SIZE; - writel(x, sig + AST_HWC_SIGNATURE_X); - writel(y, sig + AST_HWC_SIGNATURE_Y); - - x_offset = ast_crtc->offset_x; - y_offset = ast_crtc->offset_y; - if (x < 0) { - x_offset = (-x) + ast_crtc->offset_x; - x = 0; - } - - if (y < 0) { - y_offset = (-y) + ast_crtc->offset_y; - y = 0; - } - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc2, x_offset); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc3, y_offset); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc4, (x & 0xff)); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc5, ((x >> 8) & 0x0f)); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc6, (y & 0xff)); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07)); - - /* dummy write to fire HWC */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xCB, 0xFF, 0x00); - - return 0; -} diff --git a/trunk/drivers/gpu/drm/ast/ast_post.c b/trunk/drivers/gpu/drm/ast/ast_post.c deleted file mode 100644 index 6edbee63b0cb..000000000000 --- a/trunk/drivers/gpu/drm/ast/ast_post.c +++ /dev/null @@ -1,1780 +0,0 @@ -/* - * Copyright 2012 Red Hat Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - */ -/* - * Authors: Dave Airlie - */ - -#include "drmP.h" -#include "ast_drv.h" - -#include "ast_dram_tables.h" - -static void ast_init_dram_2300(struct drm_device *dev); - -static void -ast_enable_vga(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - - ast_io_write8(ast, 0x43, 0x01); - ast_io_write8(ast, 0x42, 0x01); -} - -#if 0 /* will use later */ -static bool -ast_is_vga_enabled(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - u8 ch; - - if (ast->chip == AST1180) { - /* TODO 1180 */ - } else { - ch = ast_io_read8(ast, 0x43); - if (ch) { - ast_open_key(ast); - ch = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0xff); - return ch & 0x04; - } - } - return 0; -} -#endif - -static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff }; -static const u8 extreginfo_ast2300a0[] = { 0x0f, 0x04, 0x1c, 0xff }; -static const u8 extreginfo_ast2300[] = { 0x0f, 0x04, 0x1f, 0xff }; - -static void -ast_set_def_ext_reg(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - u8 i, index, reg; - const u8 *ext_reg_info; - - /* reset scratch */ - for (i = 0x81; i <= 0x8f; i++) - ast_set_index_reg(ast, AST_IO_CRTC_PORT, i, 0x00); - - if (ast->chip == AST2300) { - if (dev->pdev->revision >= 0x20) - ext_reg_info = extreginfo_ast2300; - else - ext_reg_info = extreginfo_ast2300a0; - } else - ext_reg_info = extreginfo; - - index = 0xa0; - while (*ext_reg_info != 0xff) { - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, index, 0x00, *ext_reg_info); - index++; - ext_reg_info++; - } - - /* disable standard IO/MEM decode if secondary */ - /* ast_set_index_reg-mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x3); */ - - /* Set Ext. Default */ - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x8c, 0x00, 0x01); - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x00, 0x00); - - /* Enable RAMDAC for A1 */ - reg = 0x04; - if (ast->chip == AST2300) - reg |= 0x20; - ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb6, 0xff, reg); -} - -static inline u32 mindwm(struct ast_private *ast, u32 r) -{ - ast_write32(ast, 0xf004, r & 0xffff0000); - ast_write32(ast, 0xf000, 0x1); - - return ast_read32(ast, 0x10000 + (r & 0x0000ffff)); -} - -static inline void moutdwm(struct ast_private *ast, u32 r, u32 v) -{ - ast_write32(ast, 0xf004, r & 0xffff0000); - ast_write32(ast, 0xf000, 0x1); - ast_write32(ast, 0x10000 + (r & 0x0000ffff), v); -} - -/* - * AST2100/2150 DLL CBR Setting - */ -#define CBR_SIZE_AST2150 ((16 << 10) - 1) -#define CBR_PASSNUM_AST2150 5 -#define CBR_THRESHOLD_AST2150 10 -#define CBR_THRESHOLD2_AST2150 10 -#define TIMEOUT_AST2150 5000000 - -#define CBR_PATNUM_AST2150 8 - -static const u32 pattern_AST2150[14] = { - 0xFF00FF00, - 0xCC33CC33, - 0xAA55AA55, - 0xFFFE0001, - 0x683501FE, - 0x0F1929B0, - 0x2D0B4346, - 0x60767F02, - 0x6FBE36A6, - 0x3A253035, - 0x3019686D, - 0x41C6167E, - 0x620152BF, - 0x20F050E0 -}; - -static u32 mmctestburst2_ast2150(struct ast_private *ast, u32 datagen) -{ - u32 data, timeout; - - moutdwm(ast, 0x1e6e0070, 0x00000000); - moutdwm(ast, 0x1e6e0070, 0x00000001 | (datagen << 3)); - timeout = 0; - do { - data = mindwm(ast, 0x1e6e0070) & 0x40; - if (++timeout > TIMEOUT_AST2150) { - moutdwm(ast, 0x1e6e0070, 0x00000000); - return 0xffffffff; - } - } while (!data); - moutdwm(ast, 0x1e6e0070, 0x00000000); - moutdwm(ast, 0x1e6e0070, 0x00000003 | (datagen << 3)); - timeout = 0; - do { - data = mindwm(ast, 0x1e6e0070) & 0x40; - if (++timeout > TIMEOUT_AST2150) { - moutdwm(ast, 0x1e6e0070, 0x00000000); - return 0xffffffff; - } - } while (!data); - data = (mindwm(ast, 0x1e6e0070) & 0x80) >> 7; - moutdwm(ast, 0x1e6e0070, 0x00000000); - return data; -} - -#if 0 /* unused in DDX driver - here for completeness */ -static u32 mmctestsingle2_ast2150(struct ast_private *ast, u32 datagen) -{ - u32 data, timeout; - - moutdwm(ast, 0x1e6e0070, 0x00000000); - moutdwm(ast, 0x1e6e0070, 0x00000005 | (datagen << 3)); - timeout = 0; - do { - data = mindwm(ast, 0x1e6e0070) & 0x40; - if (++timeout > TIMEOUT_AST2150) { - moutdwm(ast, 0x1e6e0070, 0x00000000); - return 0xffffffff; - } - } while (!data); - data = (mindwm(ast, 0x1e6e0070) & 0x80) >> 7; - moutdwm(ast, 0x1e6e0070, 0x00000000); - return data; -} -#endif - -static int cbrtest_ast2150(struct ast_private *ast) -{ - int i; - - for (i = 0; i < 8; i++) - if (mmctestburst2_ast2150(ast, i)) - return 0; - return 1; -} - -static int cbrscan_ast2150(struct ast_private *ast, int busw) -{ - u32 patcnt, loop; - - for (patcnt = 0; patcnt < CBR_PATNUM_AST2150; patcnt++) { - moutdwm(ast, 0x1e6e007c, pattern_AST2150[patcnt]); - for (loop = 0; loop < CBR_PASSNUM_AST2150; loop++) { - if (cbrtest_ast2150(ast)) - break; - } - if (loop == CBR_PASSNUM_AST2150) - return 0; - } - return 1; -} - - -static void cbrdlli_ast2150(struct ast_private *ast, int busw) -{ - u32 dll_min[4], dll_max[4], dlli, data, passcnt; - -cbr_start: - dll_min[0] = dll_min[1] = dll_min[2] = dll_min[3] = 0xff; - dll_max[0] = dll_max[1] = dll_max[2] = dll_max[3] = 0x0; - passcnt = 0; - - for (dlli = 0; dlli < 100; dlli++) { - moutdwm(ast, 0x1e6e0068, dlli | (dlli << 8) | (dlli << 16) | (dlli << 24)); - data = cbrscan_ast2150(ast, busw); - if (data != 0) { - if (data & 0x1) { - if (dll_min[0] > dlli) - dll_min[0] = dlli; - if (dll_max[0] < dlli) - dll_max[0] = dlli; - } - passcnt++; - } else if (passcnt >= CBR_THRESHOLD_AST2150) - goto cbr_start; - } - if (dll_max[0] == 0 || (dll_max[0]-dll_min[0]) < CBR_THRESHOLD_AST2150) - goto cbr_start; - - dlli = dll_min[0] + (((dll_max[0] - dll_min[0]) * 7) >> 4); - moutdwm(ast, 0x1e6e0068, dlli | (dlli << 8) | (dlli << 16) | (dlli << 24)); -} - - - -static void ast_init_dram_reg(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - u8 j; - u32 data, temp, i; - const struct ast_dramstruct *dram_reg_info; - - j = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); - - if ((j & 0x80) == 0) { /* VGA only */ - if (ast->chip == AST2000) { - dram_reg_info = ast2000_dram_table_data; - ast_write32(ast, 0xf004, 0x1e6e0000); - ast_write32(ast, 0xf000, 0x1); - ast_write32(ast, 0x10100, 0xa8); - - do { - ; - } while (ast_read32(ast, 0x10100) != 0xa8); - } else {/* AST2100/1100 */ - if (ast->chip == AST2100 || ast->chip == 2200) - dram_reg_info = ast2100_dram_table_data; - else - dram_reg_info = ast1100_dram_table_data; - - ast_write32(ast, 0xf004, 0x1e6e0000); - ast_write32(ast, 0xf000, 0x1); - ast_write32(ast, 0x12000, 0x1688A8A8); - do { - ; - } while (ast_read32(ast, 0x12000) != 0x01); - - ast_write32(ast, 0x10000, 0xfc600309); - do { - ; - } while (ast_read32(ast, 0x10000) != 0x01); - } - - while (dram_reg_info->index != 0xffff) { - if (dram_reg_info->index == 0xff00) {/* delay fn */ - for (i = 0; i < 15; i++) - udelay(dram_reg_info->data); - } else if (dram_reg_info->index == 0x4 && ast->chip != AST2000) { - data = dram_reg_info->data; - if (ast->dram_type == AST_DRAM_1Gx16) - data = 0x00000d89; - else if (ast->dram_type == AST_DRAM_1Gx32) - data = 0x00000c8d; - - temp = ast_read32(ast, 0x12070); - temp &= 0xc; - temp <<= 2; - ast_write32(ast, 0x10000 + dram_reg_info->index, data | temp); - } else - ast_write32(ast, 0x10000 + dram_reg_info->index, dram_reg_info->data); - dram_reg_info++; - } - - /* AST 2100/2150 DRAM calibration */ - data = ast_read32(ast, 0x10120); - if (data == 0x5061) { /* 266Mhz */ - data = ast_read32(ast, 0x10004); - if (data & 0x40) - cbrdlli_ast2150(ast, 16); /* 16 bits */ - else - cbrdlli_ast2150(ast, 32); /* 32 bits */ - } - - switch (ast->chip) { - case AST2000: - temp = ast_read32(ast, 0x10140); - ast_write32(ast, 0x10140, temp | 0x40); - break; - case AST1100: - case AST2100: - case AST2200: - case AST2150: - temp = ast_read32(ast, 0x1200c); - ast_write32(ast, 0x1200c, temp & 0xfffffffd); - temp = ast_read32(ast, 0x12040); - ast_write32(ast, 0x12040, temp | 0x40); - break; - default: - break; - } - } - - /* wait ready */ - do { - j = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); - } while ((j & 0x40) == 0); -} - -void ast_post_gpu(struct drm_device *dev) -{ - u32 reg; - struct ast_private *ast = dev->dev_private; - - pci_read_config_dword(ast->dev->pdev, 0x04, ®); - reg |= 0x3; - pci_write_config_dword(ast->dev->pdev, 0x04, reg); - - ast_enable_vga(dev); - ast_open_key(ast); - ast_set_def_ext_reg(dev); - - if (ast->chip == AST2300) - ast_init_dram_2300(dev); - else - ast_init_dram_reg(dev); -} - -/* AST 2300 DRAM settings */ -#define AST_DDR3 0 -#define AST_DDR2 1 - -struct ast2300_dram_param { - u32 dram_type; - u32 dram_chipid; - u32 dram_freq; - u32 vram_size; - u32 odt; - u32 wodt; - u32 rodt; - u32 dram_config; - u32 reg_PERIOD; - u32 reg_MADJ; - u32 reg_SADJ; - u32 reg_MRS; - u32 reg_EMRS; - u32 reg_AC1; - u32 reg_AC2; - u32 reg_DQSIC; - u32 reg_DRV; - u32 reg_IOZ; - u32 reg_DQIDLY; - u32 reg_FREQ; - u32 madj_max; - u32 dll2_finetune_step; -}; - -/* - * DQSI DLL CBR Setting - */ -#define CBR_SIZE1 ((4 << 10) - 1) -#define CBR_SIZE2 ((64 << 10) - 1) -#define CBR_PASSNUM 5 -#define CBR_PASSNUM2 5 -#define CBR_THRESHOLD 10 -#define CBR_THRESHOLD2 10 -#define TIMEOUT 5000000 -#define CBR_PATNUM 8 - -static const u32 pattern[8] = { - 0xFF00FF00, - 0xCC33CC33, - 0xAA55AA55, - 0x88778877, - 0x92CC4D6E, - 0x543D3CDE, - 0xF1E843C7, - 0x7C61D253 -}; - -#if 0 /* unused in DDX, included for completeness */ -static int mmc_test_burst(struct ast_private *ast, u32 datagen) -{ - u32 data, timeout; - - moutdwm(ast, 0x1e6e0070, 0x00000000); - moutdwm(ast, 0x1e6e0070, 0x000000c1 | (datagen << 3)); - timeout = 0; - do { - data = mindwm(ast, 0x1e6e0070) & 0x3000; - if (data & 0x2000) { - return 0; - } - if (++timeout > TIMEOUT) { - moutdwm(ast, 0x1e6e0070, 0x00000000); - return 0; - } - } while (!data); - moutdwm(ast, 0x1e6e0070, 0x00000000); - return 1; -} -#endif - -static int mmc_test_burst2(struct ast_private *ast, u32 datagen) -{ - u32 data, timeout; - - moutdwm(ast, 0x1e6e0070, 0x00000000); - moutdwm(ast, 0x1e6e0070, 0x00000041 | (datagen << 3)); - timeout = 0; - do { - data = mindwm(ast, 0x1e6e0070) & 0x1000; - if (++timeout > TIMEOUT) { - moutdwm(ast, 0x1e6e0070, 0x0); - return -1; - } - } while (!data); - data = mindwm(ast, 0x1e6e0078); - data = (data | (data >> 16)) & 0xffff; - moutdwm(ast, 0x1e6e0070, 0x0); - return data; -} - -#if 0 /* Unused in DDX here for completeness */ -static int mmc_test_single(struct ast_private *ast, u32 datagen) -{ - u32 data, timeout; - - moutdwm(ast, 0x1e6e0070, 0x00000000); - moutdwm(ast, 0x1e6e0070, 0x000000c5 | (datagen << 3)); - timeout = 0; - do { - data = mindwm(ast, 0x1e6e0070) & 0x3000; - if (data & 0x2000) - return 0; - if (++timeout > TIMEOUT) { - moutdwm(ast, 0x1e6e0070, 0x0); - return 0; - } - } while (!data); - moutdwm(ast, 0x1e6e0070, 0x0); - return 1; -} -#endif - -static int mmc_test_single2(struct ast_private *ast, u32 datagen) -{ - u32 data, timeout; - - moutdwm(ast, 0x1e6e0070, 0x00000000); - moutdwm(ast, 0x1e6e0070, 0x00000005 | (datagen << 3)); - timeout = 0; - do { - data = mindwm(ast, 0x1e6e0070) & 0x1000; - if (++timeout > TIMEOUT) { - moutdwm(ast, 0x1e6e0070, 0x0); - return -1; - } - } while (!data); - data = mindwm(ast, 0x1e6e0078); - data = (data | (data >> 16)) & 0xffff; - moutdwm(ast, 0x1e6e0070, 0x0); - return data; -} - -static int cbr_test(struct ast_private *ast) -{ - u32 data; - int i; - data = mmc_test_single2(ast, 0); - if ((data & 0xff) && (data & 0xff00)) - return 0; - for (i = 0; i < 8; i++) { - data = mmc_test_burst2(ast, i); - if ((data & 0xff) && (data & 0xff00)) - return 0; - } - if (!data) - return 3; - else if (data & 0xff) - return 2; - return 1; -} - -static int cbr_scan(struct ast_private *ast) -{ - u32 data, data2, patcnt, loop; - - data2 = 3; - for (patcnt = 0; patcnt < CBR_PATNUM; patcnt++) { - moutdwm(ast, 0x1e6e007c, pattern[patcnt]); - for (loop = 0; loop < CBR_PASSNUM2; loop++) { - if ((data = cbr_test(ast)) != 0) { - data2 &= data; - if (!data2) - return 0; - break; - } - } - if (loop == CBR_PASSNUM2) - return 0; - } - return data2; -} - -static u32 cbr_test2(struct ast_private *ast) -{ - u32 data; - - data = mmc_test_burst2(ast, 0); - if (data == 0xffff) - return 0; - data |= mmc_test_single2(ast, 0); - if (data == 0xffff) - return 0; - - return ~data & 0xffff; -} - -static u32 cbr_scan2(struct ast_private *ast) -{ - u32 data, data2, patcnt, loop; - - data2 = 0xffff; - for (patcnt = 0; patcnt < CBR_PATNUM; patcnt++) { - moutdwm(ast, 0x1e6e007c, pattern[patcnt]); - for (loop = 0; loop < CBR_PASSNUM2; loop++) { - if ((data = cbr_test2(ast)) != 0) { - data2 &= data; - if (!data) - return 0; - break; - } - } - if (loop == CBR_PASSNUM2) - return 0; - } - return data2; -} - -#if 0 /* unused in DDX - added for completeness */ -static void finetuneDQI(struct ast_private *ast, struct ast2300_dram_param *param) -{ - u32 gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt; - - gold_sadj[0] = (mindwm(ast, 0x1E6E0024) >> 16) & 0xffff; - gold_sadj[1] = gold_sadj[0] >> 8; - gold_sadj[0] = gold_sadj[0] & 0xff; - gold_sadj[0] = (gold_sadj[0] + gold_sadj[1]) >> 1; - gold_sadj[1] = gold_sadj[0]; - - for (cnt = 0; cnt < 16; cnt++) { - dllmin[cnt] = 0xff; - dllmax[cnt] = 0x0; - } - passcnt = 0; - for (dlli = 0; dlli < 76; dlli++) { - moutdwm(ast, 0x1E6E0068, 0x00001400 | (dlli << 16) | (dlli << 24)); - /* Wait DQSI latch phase calibration */ - moutdwm(ast, 0x1E6E0074, 0x00000010); - moutdwm(ast, 0x1E6E0070, 0x00000003); - do { - data = mindwm(ast, 0x1E6E0070); - } while (!(data & 0x00001000)); - moutdwm(ast, 0x1E6E0070, 0x00000000); - - moutdwm(ast, 0x1E6E0074, CBR_SIZE1); - data = cbr_scan2(ast); - if (data != 0) { - mask = 0x00010001; - for (cnt = 0; cnt < 16; cnt++) { - if (data & mask) { - if (dllmin[cnt] > dlli) { - dllmin[cnt] = dlli; - } - if (dllmax[cnt] < dlli) { - dllmax[cnt] = dlli; - } - } - mask <<= 1; - } - passcnt++; - } else if (passcnt >= CBR_THRESHOLD) { - break; - } - } - data = 0; - for (cnt = 0; cnt < 8; cnt++) { - data >>= 3; - if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD)) { - dlli = (dllmin[cnt] + dllmax[cnt]) >> 1; - if (gold_sadj[0] >= dlli) { - dlli = (gold_sadj[0] - dlli) >> 1; - if (dlli > 3) { - dlli = 3; - } - } else { - dlli = (dlli - gold_sadj[0]) >> 1; - if (dlli > 4) { - dlli = 4; - } - dlli = (8 - dlli) & 0x7; - } - data |= dlli << 21; - } - } - moutdwm(ast, 0x1E6E0080, data); - - data = 0; - for (cnt = 8; cnt < 16; cnt++) { - data >>= 3; - if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD)) { - dlli = (dllmin[cnt] + dllmax[cnt]) >> 1; - if (gold_sadj[1] >= dlli) { - dlli = (gold_sadj[1] - dlli) >> 1; - if (dlli > 3) { - dlli = 3; - } else { - dlli = (dlli - 1) & 0x7; - } - } else { - dlli = (dlli - gold_sadj[1]) >> 1; - dlli += 1; - if (dlli > 4) { - dlli = 4; - } - dlli = (8 - dlli) & 0x7; - } - data |= dlli << 21; - } - } - moutdwm(ast, 0x1E6E0084, data); - -} /* finetuneDQI */ -#endif - -static void finetuneDQI_L(struct ast_private *ast, struct ast2300_dram_param *param) -{ - u32 gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt; - -FINETUNE_START: - for (cnt = 0; cnt < 16; cnt++) { - dllmin[cnt] = 0xff; - dllmax[cnt] = 0x0; - } - passcnt = 0; - for (dlli = 0; dlli < 76; dlli++) { - moutdwm(ast, 0x1E6E0068, 0x00001400 | (dlli << 16) | (dlli << 24)); - /* Wait DQSI latch phase calibration */ - moutdwm(ast, 0x1E6E0074, 0x00000010); - moutdwm(ast, 0x1E6E0070, 0x00000003); - do { - data = mindwm(ast, 0x1E6E0070); - } while (!(data & 0x00001000)); - moutdwm(ast, 0x1E6E0070, 0x00000000); - - moutdwm(ast, 0x1E6E0074, CBR_SIZE1); - data = cbr_scan2(ast); - if (data != 0) { - mask = 0x00010001; - for (cnt = 0; cnt < 16; cnt++) { - if (data & mask) { - if (dllmin[cnt] > dlli) { - dllmin[cnt] = dlli; - } - if (dllmax[cnt] < dlli) { - dllmax[cnt] = dlli; - } - } - mask <<= 1; - } - passcnt++; - } else if (passcnt >= CBR_THRESHOLD2) { - break; - } - } - gold_sadj[0] = 0x0; - passcnt = 0; - for (cnt = 0; cnt < 16; cnt++) { - if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) { - gold_sadj[0] += dllmin[cnt]; - passcnt++; - } - } - if (passcnt != 16) { - goto FINETUNE_START; - } - gold_sadj[0] = gold_sadj[0] >> 4; - gold_sadj[1] = gold_sadj[0]; - - data = 0; - for (cnt = 0; cnt < 8; cnt++) { - data >>= 3; - if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) { - dlli = dllmin[cnt]; - if (gold_sadj[0] >= dlli) { - dlli = ((gold_sadj[0] - dlli) * 19) >> 5; - if (dlli > 3) { - dlli = 3; - } - } else { - dlli = ((dlli - gold_sadj[0]) * 19) >> 5; - if (dlli > 4) { - dlli = 4; - } - dlli = (8 - dlli) & 0x7; - } - data |= dlli << 21; - } - } - moutdwm(ast, 0x1E6E0080, data); - - data = 0; - for (cnt = 8; cnt < 16; cnt++) { - data >>= 3; - if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) { - dlli = dllmin[cnt]; - if (gold_sadj[1] >= dlli) { - dlli = ((gold_sadj[1] - dlli) * 19) >> 5; - if (dlli > 3) { - dlli = 3; - } else { - dlli = (dlli - 1) & 0x7; - } - } else { - dlli = ((dlli - gold_sadj[1]) * 19) >> 5; - dlli += 1; - if (dlli > 4) { - dlli = 4; - } - dlli = (8 - dlli) & 0x7; - } - data |= dlli << 21; - } - } - moutdwm(ast, 0x1E6E0084, data); - -} /* finetuneDQI_L */ - -static void finetuneDQI_L2(struct ast_private *ast, struct ast2300_dram_param *param) -{ - u32 gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt, data2; - - for (cnt = 0; cnt < 16; cnt++) { - dllmin[cnt] = 0xff; - dllmax[cnt] = 0x0; - } - passcnt = 0; - for (dlli = 0; dlli < 76; dlli++) { - moutdwm(ast, 0x1E6E0068, 0x00001400 | (dlli << 16) | (dlli << 24)); - /* Wait DQSI latch phase calibration */ - moutdwm(ast, 0x1E6E0074, 0x00000010); - moutdwm(ast, 0x1E6E0070, 0x00000003); - do { - data = mindwm(ast, 0x1E6E0070); - } while (!(data & 0x00001000)); - moutdwm(ast, 0x1E6E0070, 0x00000000); - - moutdwm(ast, 0x1E6E0074, CBR_SIZE2); - data = cbr_scan2(ast); - if (data != 0) { - mask = 0x00010001; - for (cnt = 0; cnt < 16; cnt++) { - if (data & mask) { - if (dllmin[cnt] > dlli) { - dllmin[cnt] = dlli; - } - if (dllmax[cnt] < dlli) { - dllmax[cnt] = dlli; - } - } - mask <<= 1; - } - passcnt++; - } else if (passcnt >= CBR_THRESHOLD2) { - break; - } - } - gold_sadj[0] = 0x0; - gold_sadj[1] = 0xFF; - for (cnt = 0; cnt < 8; cnt++) { - if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) { - if (gold_sadj[0] < dllmin[cnt]) { - gold_sadj[0] = dllmin[cnt]; - } - if (gold_sadj[1] > dllmax[cnt]) { - gold_sadj[1] = dllmax[cnt]; - } - } - } - gold_sadj[0] = (gold_sadj[1] + gold_sadj[0]) >> 1; - gold_sadj[1] = mindwm(ast, 0x1E6E0080); - - data = 0; - for (cnt = 0; cnt < 8; cnt++) { - data >>= 3; - data2 = gold_sadj[1] & 0x7; - gold_sadj[1] >>= 3; - if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) { - dlli = (dllmin[cnt] + dllmax[cnt]) >> 1; - if (gold_sadj[0] >= dlli) { - dlli = (gold_sadj[0] - dlli) >> 1; - if (dlli > 0) { - dlli = 1; - } - if (data2 != 3) { - data2 = (data2 + dlli) & 0x7; - } - } else { - dlli = (dlli - gold_sadj[0]) >> 1; - if (dlli > 0) { - dlli = 1; - } - if (data2 != 4) { - data2 = (data2 - dlli) & 0x7; - } - } - } - data |= data2 << 21; - } - moutdwm(ast, 0x1E6E0080, data); - - gold_sadj[0] = 0x0; - gold_sadj[1] = 0xFF; - for (cnt = 8; cnt < 16; cnt++) { - if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) { - if (gold_sadj[0] < dllmin[cnt]) { - gold_sadj[0] = dllmin[cnt]; - } - if (gold_sadj[1] > dllmax[cnt]) { - gold_sadj[1] = dllmax[cnt]; - } - } - } - gold_sadj[0] = (gold_sadj[1] + gold_sadj[0]) >> 1; - gold_sadj[1] = mindwm(ast, 0x1E6E0084); - - data = 0; - for (cnt = 8; cnt < 16; cnt++) { - data >>= 3; - data2 = gold_sadj[1] & 0x7; - gold_sadj[1] >>= 3; - if ((dllmax[cnt] > dllmin[cnt]) && ((dllmax[cnt] - dllmin[cnt]) >= CBR_THRESHOLD2)) { - dlli = (dllmin[cnt] + dllmax[cnt]) >> 1; - if (gold_sadj[0] >= dlli) { - dlli = (gold_sadj[0] - dlli) >> 1; - if (dlli > 0) { - dlli = 1; - } - if (data2 != 3) { - data2 = (data2 + dlli) & 0x7; - } - } else { - dlli = (dlli - gold_sadj[0]) >> 1; - if (dlli > 0) { - dlli = 1; - } - if (data2 != 4) { - data2 = (data2 - dlli) & 0x7; - } - } - } - data |= data2 << 21; - } - moutdwm(ast, 0x1E6E0084, data); - -} /* finetuneDQI_L2 */ - -static void cbr_dll2(struct ast_private *ast, struct ast2300_dram_param *param) -{ - u32 dllmin[2], dllmax[2], dlli, data, data2, passcnt; - - - finetuneDQI_L(ast, param); - finetuneDQI_L2(ast, param); - -CBR_START2: - dllmin[0] = dllmin[1] = 0xff; - dllmax[0] = dllmax[1] = 0x0; - passcnt = 0; - for (dlli = 0; dlli < 76; dlli++) { - moutdwm(ast, 0x1E6E0068, 0x00001300 | (dlli << 16) | (dlli << 24)); - /* Wait DQSI latch phase calibration */ - moutdwm(ast, 0x1E6E0074, 0x00000010); - moutdwm(ast, 0x1E6E0070, 0x00000003); - do { - data = mindwm(ast, 0x1E6E0070); - } while (!(data & 0x00001000)); - moutdwm(ast, 0x1E6E0070, 0x00000000); - - moutdwm(ast, 0x1E6E0074, CBR_SIZE2); - data = cbr_scan(ast); - if (data != 0) { - if (data & 0x1) { - if (dllmin[0] > dlli) { - dllmin[0] = dlli; - } - if (dllmax[0] < dlli) { - dllmax[0] = dlli; - } - } - if (data & 0x2) { - if (dllmin[1] > dlli) { - dllmin[1] = dlli; - } - if (dllmax[1] < dlli) { - dllmax[1] = dlli; - } - } - passcnt++; - } else if (passcnt >= CBR_THRESHOLD) { - break; - } - } - if (dllmax[0] == 0 || (dllmax[0]-dllmin[0]) < CBR_THRESHOLD) { - goto CBR_START2; - } - if (dllmax[1] == 0 || (dllmax[1]-dllmin[1]) < CBR_THRESHOLD) { - goto CBR_START2; - } - dlli = (dllmin[1] + dllmax[1]) >> 1; - dlli <<= 8; - dlli += (dllmin[0] + dllmax[0]) >> 1; - moutdwm(ast, 0x1E6E0068, (mindwm(ast, 0x1E6E0068) & 0xFFFF) | (dlli << 16)); - - data = (mindwm(ast, 0x1E6E0080) >> 24) & 0x1F; - data2 = (mindwm(ast, 0x1E6E0018) & 0xff80ffff) | (data << 16); - moutdwm(ast, 0x1E6E0018, data2); - moutdwm(ast, 0x1E6E0024, 0x8001 | (data << 1) | (param->dll2_finetune_step << 8)); - - /* Wait DQSI latch phase calibration */ - moutdwm(ast, 0x1E6E0074, 0x00000010); - moutdwm(ast, 0x1E6E0070, 0x00000003); - do { - data = mindwm(ast, 0x1E6E0070); - } while (!(data & 0x00001000)); - moutdwm(ast, 0x1E6E0070, 0x00000000); - moutdwm(ast, 0x1E6E0070, 0x00000003); - do { - data = mindwm(ast, 0x1E6E0070); - } while (!(data & 0x00001000)); - moutdwm(ast, 0x1E6E0070, 0x00000000); -} /* CBRDLL2 */ - -static void get_ddr3_info(struct ast_private *ast, struct ast2300_dram_param *param) -{ - u32 trap, trap_AC2, trap_MRS; - - moutdwm(ast, 0x1E6E2000, 0x1688A8A8); - - /* Ger trap info */ - trap = (mindwm(ast, 0x1E6E2070) >> 25) & 0x3; - trap_AC2 = 0x00020000 + (trap << 16); - trap_AC2 |= 0x00300000 + ((trap & 0x2) << 19); - trap_MRS = 0x00000010 + (trap << 4); - trap_MRS |= ((trap & 0x2) << 18); - - param->reg_MADJ = 0x00034C4C; - param->reg_SADJ = 0x00001800; - param->reg_DRV = 0x000000F0; - param->reg_PERIOD = param->dram_freq; - param->rodt = 0; - - switch (param->dram_freq) { - case 336: - moutdwm(ast, 0x1E6E2020, 0x0190); - param->wodt = 0; - param->reg_AC1 = 0x22202725; - param->reg_AC2 = 0xAA007613 | trap_AC2; - param->reg_DQSIC = 0x000000BA; - param->reg_MRS = 0x04001400 | trap_MRS; - param->reg_EMRS = 0x00000000; - param->reg_IOZ = 0x00000034; - param->reg_DQIDLY = 0x00000074; - param->reg_FREQ = 0x00004DC0; - param->madj_max = 96; - param->dll2_finetune_step = 3; - break; - default: - case 396: - moutdwm(ast, 0x1E6E2020, 0x03F1); - param->wodt = 1; - param->reg_AC1 = 0x33302825; - param->reg_AC2 = 0xCC009617 | trap_AC2; - param->reg_DQSIC = 0x000000E2; - param->reg_MRS = 0x04001600 | trap_MRS; - param->reg_EMRS = 0x00000000; - param->reg_IOZ = 0x00000034; - param->reg_DRV = 0x000000FA; - param->reg_DQIDLY = 0x00000089; - param->reg_FREQ = 0x000050C0; - param->madj_max = 96; - param->dll2_finetune_step = 4; - - switch (param->dram_chipid) { - default: - case AST_DRAM_512Mx16: - case AST_DRAM_1Gx16: - param->reg_AC2 = 0xCC009617 | trap_AC2; - break; - case AST_DRAM_2Gx16: - param->reg_AC2 = 0xCC009622 | trap_AC2; - break; - case AST_DRAM_4Gx16: - param->reg_AC2 = 0xCC00963F | trap_AC2; - break; - } - break; - - case 408: - moutdwm(ast, 0x1E6E2020, 0x01F0); - param->wodt = 1; - param->reg_AC1 = 0x33302825; - param->reg_AC2 = 0xCC009617 | trap_AC2; - param->reg_DQSIC = 0x000000E2; - param->reg_MRS = 0x04001600 | trap_MRS; - param->reg_EMRS = 0x00000000; - param->reg_IOZ = 0x00000034; - param->reg_DRV = 0x000000FA; - param->reg_DQIDLY = 0x00000089; - param->reg_FREQ = 0x000050C0; - param->madj_max = 96; - param->dll2_finetune_step = 4; - - switch (param->dram_chipid) { - default: - case AST_DRAM_512Mx16: - case AST_DRAM_1Gx16: - param->reg_AC2 = 0xCC009617 | trap_AC2; - break; - case AST_DRAM_2Gx16: - param->reg_AC2 = 0xCC009622 | trap_AC2; - break; - case AST_DRAM_4Gx16: - param->reg_AC2 = 0xCC00963F | trap_AC2; - break; - } - - break; - case 456: - moutdwm(ast, 0x1E6E2020, 0x0230); - param->wodt = 0; - param->reg_AC1 = 0x33302926; - param->reg_AC2 = 0xCD44961A; - param->reg_DQSIC = 0x000000FC; - param->reg_MRS = 0x00081830; - param->reg_EMRS = 0x00000000; - param->reg_IOZ = 0x00000045; - param->reg_DQIDLY = 0x00000097; - param->reg_FREQ = 0x000052C0; - param->madj_max = 88; - param->dll2_finetune_step = 4; - break; - case 504: - moutdwm(ast, 0x1E6E2020, 0x0270); - param->wodt = 1; - param->reg_AC1 = 0x33302926; - param->reg_AC2 = 0xDE44A61D; - param->reg_DQSIC = 0x00000117; - param->reg_MRS = 0x00081A30; - param->reg_EMRS = 0x00000000; - param->reg_IOZ = 0x070000BB; - param->reg_DQIDLY = 0x000000A0; - param->reg_FREQ = 0x000054C0; - param->madj_max = 79; - param->dll2_finetune_step = 4; - break; - case 528: - moutdwm(ast, 0x1E6E2020, 0x0290); - param->wodt = 1; - param->rodt = 1; - param->reg_AC1 = 0x33302926; - param->reg_AC2 = 0xEF44B61E; - param->reg_DQSIC = 0x00000125; - param->reg_MRS = 0x00081A30; - param->reg_EMRS = 0x00000040; - param->reg_DRV = 0x000000F5; - param->reg_IOZ = 0x00000023; - param->reg_DQIDLY = 0x00000088; - param->reg_FREQ = 0x000055C0; - param->madj_max = 76; - param->dll2_finetune_step = 3; - break; - case 576: - moutdwm(ast, 0x1E6E2020, 0x0140); - param->reg_MADJ = 0x00136868; - param->reg_SADJ = 0x00004534; - param->wodt = 1; - param->rodt = 1; - param->reg_AC1 = 0x33302A37; - param->reg_AC2 = 0xEF56B61E; - param->reg_DQSIC = 0x0000013F; - param->reg_MRS = 0x00101A50; - param->reg_EMRS = 0x00000040; - param->reg_DRV = 0x000000FA; - param->reg_IOZ = 0x00000023; - param->reg_DQIDLY = 0x00000078; - param->reg_FREQ = 0x000057C0; - param->madj_max = 136; - param->dll2_finetune_step = 3; - break; - case 600: - moutdwm(ast, 0x1E6E2020, 0x02E1); - param->reg_MADJ = 0x00136868; - param->reg_SADJ = 0x00004534; - param->wodt = 1; - param->rodt = 1; - param->reg_AC1 = 0x32302A37; - param->reg_AC2 = 0xDF56B61F; - param->reg_DQSIC = 0x0000014D; - param->reg_MRS = 0x00101A50; - param->reg_EMRS = 0x00000004; - param->reg_DRV = 0x000000F5; - param->reg_IOZ = 0x00000023; - param->reg_DQIDLY = 0x00000078; - param->reg_FREQ = 0x000058C0; - param->madj_max = 132; - param->dll2_finetune_step = 3; - break; - case 624: - moutdwm(ast, 0x1E6E2020, 0x0160); - param->reg_MADJ = 0x00136868; - param->reg_SADJ = 0x00004534; - param->wodt = 1; - param->rodt = 1; - param->reg_AC1 = 0x32302A37; - param->reg_AC2 = 0xEF56B621; - param->reg_DQSIC = 0x0000015A; - param->reg_MRS = 0x02101A50; - param->reg_EMRS = 0x00000004; - param->reg_DRV = 0x000000F5; - param->reg_IOZ = 0x00000034; - param->reg_DQIDLY = 0x00000078; - param->reg_FREQ = 0x000059C0; - param->madj_max = 128; - param->dll2_finetune_step = 3; - break; - } /* switch freq */ - - switch (param->dram_chipid) { - case AST_DRAM_512Mx16: - param->dram_config = 0x130; - break; - default: - case AST_DRAM_1Gx16: - param->dram_config = 0x131; - break; - case AST_DRAM_2Gx16: - param->dram_config = 0x132; - break; - case AST_DRAM_4Gx16: - param->dram_config = 0x133; - break; - }; /* switch size */ - - switch (param->vram_size) { - default: - case AST_VIDMEM_SIZE_8M: - param->dram_config |= 0x00; - break; - case AST_VIDMEM_SIZE_16M: - param->dram_config |= 0x04; - break; - case AST_VIDMEM_SIZE_32M: - param->dram_config |= 0x08; - break; - case AST_VIDMEM_SIZE_64M: - param->dram_config |= 0x0c; - break; - } - -} - -static void ddr3_init(struct ast_private *ast, struct ast2300_dram_param *param) -{ - u32 data, data2; - - moutdwm(ast, 0x1E6E0000, 0xFC600309); - moutdwm(ast, 0x1E6E0018, 0x00000100); - moutdwm(ast, 0x1E6E0024, 0x00000000); - moutdwm(ast, 0x1E6E0034, 0x00000000); - udelay(10); - moutdwm(ast, 0x1E6E0064, param->reg_MADJ); - moutdwm(ast, 0x1E6E0068, param->reg_SADJ); - udelay(10); - moutdwm(ast, 0x1E6E0064, param->reg_MADJ | 0xC0000); - udelay(10); - - moutdwm(ast, 0x1E6E0004, param->dram_config); - moutdwm(ast, 0x1E6E0008, 0x90040f); - moutdwm(ast, 0x1E6E0010, param->reg_AC1); - moutdwm(ast, 0x1E6E0014, param->reg_AC2); - moutdwm(ast, 0x1E6E0020, param->reg_DQSIC); - moutdwm(ast, 0x1E6E0080, 0x00000000); - moutdwm(ast, 0x1E6E0084, 0x00000000); - moutdwm(ast, 0x1E6E0088, param->reg_DQIDLY); - moutdwm(ast, 0x1E6E0018, 0x4040A170); - moutdwm(ast, 0x1E6E0018, 0x20402370); - moutdwm(ast, 0x1E6E0038, 0x00000000); - moutdwm(ast, 0x1E6E0040, 0xFF444444); - moutdwm(ast, 0x1E6E0044, 0x22222222); - moutdwm(ast, 0x1E6E0048, 0x22222222); - moutdwm(ast, 0x1E6E004C, 0x00000002); - moutdwm(ast, 0x1E6E0050, 0x80000000); - moutdwm(ast, 0x1E6E0050, 0x00000000); - moutdwm(ast, 0x1E6E0054, 0); - moutdwm(ast, 0x1E6E0060, param->reg_DRV); - moutdwm(ast, 0x1E6E006C, param->reg_IOZ); - moutdwm(ast, 0x1E6E0070, 0x00000000); - moutdwm(ast, 0x1E6E0074, 0x00000000); - moutdwm(ast, 0x1E6E0078, 0x00000000); - moutdwm(ast, 0x1E6E007C, 0x00000000); - /* Wait MCLK2X lock to MCLK */ - do { - data = mindwm(ast, 0x1E6E001C); - } while (!(data & 0x08000000)); - moutdwm(ast, 0x1E6E0034, 0x00000001); - moutdwm(ast, 0x1E6E000C, 0x00005C04); - udelay(10); - moutdwm(ast, 0x1E6E000C, 0x00000000); - moutdwm(ast, 0x1E6E0034, 0x00000000); - data = mindwm(ast, 0x1E6E001C); - data = (data >> 8) & 0xff; - while ((data & 0x08) || ((data & 0x7) < 2) || (data < 4)) { - data2 = (mindwm(ast, 0x1E6E0064) & 0xfff3ffff) + 4; - if ((data2 & 0xff) > param->madj_max) { - break; - } - moutdwm(ast, 0x1E6E0064, data2); - if (data2 & 0x00100000) { - data2 = ((data2 & 0xff) >> 3) + 3; - } else { - data2 = ((data2 & 0xff) >> 2) + 5; - } - data = mindwm(ast, 0x1E6E0068) & 0xffff00ff; - data2 += data & 0xff; - data = data | (data2 << 8); - moutdwm(ast, 0x1E6E0068, data); - udelay(10); - moutdwm(ast, 0x1E6E0064, mindwm(ast, 0x1E6E0064) | 0xC0000); - udelay(10); - data = mindwm(ast, 0x1E6E0018) & 0xfffff1ff; - moutdwm(ast, 0x1E6E0018, data); - data = data | 0x200; - moutdwm(ast, 0x1E6E0018, data); - do { - data = mindwm(ast, 0x1E6E001C); - } while (!(data & 0x08000000)); - - moutdwm(ast, 0x1E6E0034, 0x00000001); - moutdwm(ast, 0x1E6E000C, 0x00005C04); - udelay(10); - moutdwm(ast, 0x1E6E000C, 0x00000000); - moutdwm(ast, 0x1E6E0034, 0x00000000); - data = mindwm(ast, 0x1E6E001C); - data = (data >> 8) & 0xff; - } - data = mindwm(ast, 0x1E6E0018) | 0xC00; - moutdwm(ast, 0x1E6E0018, data); - - moutdwm(ast, 0x1E6E0034, 0x00000001); - moutdwm(ast, 0x1E6E000C, 0x00000040); - udelay(50); - /* Mode Register Setting */ - moutdwm(ast, 0x1E6E002C, param->reg_MRS | 0x100); - moutdwm(ast, 0x1E6E0030, param->reg_EMRS); - moutdwm(ast, 0x1E6E0028, 0x00000005); - moutdwm(ast, 0x1E6E0028, 0x00000007); - moutdwm(ast, 0x1E6E0028, 0x00000003); - moutdwm(ast, 0x1E6E0028, 0x00000001); - moutdwm(ast, 0x1E6E002C, param->reg_MRS); - moutdwm(ast, 0x1E6E000C, 0x00005C08); - moutdwm(ast, 0x1E6E0028, 0x00000001); - - moutdwm(ast, 0x1E6E000C, 0x7FFF5C01); - data = 0; - if (param->wodt) { - data = 0x300; - } - if (param->rodt) { - data = data | 0x3000 | ((param->reg_AC2 & 0x60000) >> 3); - } - moutdwm(ast, 0x1E6E0034, data | 0x3); - - /* Wait DQI delay lock */ - do { - data = mindwm(ast, 0x1E6E0080); - } while (!(data & 0x40000000)); - /* Wait DQSI delay lock */ - do { - data = mindwm(ast, 0x1E6E0020); - } while (!(data & 0x00000800)); - /* Calibrate the DQSI delay */ - cbr_dll2(ast, param); - - moutdwm(ast, 0x1E6E0120, param->reg_FREQ); - /* ECC Memory Initialization */ -#ifdef ECC - moutdwm(ast, 0x1E6E007C, 0x00000000); - moutdwm(ast, 0x1E6E0070, 0x221); - do { - data = mindwm(ast, 0x1E6E0070); - } while (!(data & 0x00001000)); - moutdwm(ast, 0x1E6E0070, 0x00000000); - moutdwm(ast, 0x1E6E0050, 0x80000000); - moutdwm(ast, 0x1E6E0050, 0x00000000); -#endif - - -} - -static void get_ddr2_info(struct ast_private *ast, struct ast2300_dram_param *param) -{ - u32 trap, trap_AC2, trap_MRS; - - moutdwm(ast, 0x1E6E2000, 0x1688A8A8); - - /* Ger trap info */ - trap = (mindwm(ast, 0x1E6E2070) >> 25) & 0x3; - trap_AC2 = (trap << 20) | (trap << 16); - trap_AC2 += 0x00110000; - trap_MRS = 0x00000040 | (trap << 4); - - - param->reg_MADJ = 0x00034C4C; - param->reg_SADJ = 0x00001800; - param->reg_DRV = 0x000000F0; - param->reg_PERIOD = param->dram_freq; - param->rodt = 0; - - switch (param->dram_freq) { - case 264: - moutdwm(ast, 0x1E6E2020, 0x0130); - param->wodt = 0; - param->reg_AC1 = 0x11101513; - param->reg_AC2 = 0x78117011; - param->reg_DQSIC = 0x00000092; - param->reg_MRS = 0x00000842; - param->reg_EMRS = 0x00000000; - param->reg_DRV = 0x000000F0; - param->reg_IOZ = 0x00000034; - param->reg_DQIDLY = 0x0000005A; - param->reg_FREQ = 0x00004AC0; - param->madj_max = 138; - param->dll2_finetune_step = 3; - break; - case 336: - moutdwm(ast, 0x1E6E2020, 0x0190); - param->wodt = 1; - param->reg_AC1 = 0x22202613; - param->reg_AC2 = 0xAA009016 | trap_AC2; - param->reg_DQSIC = 0x000000BA; - param->reg_MRS = 0x00000A02 | trap_MRS; - param->reg_EMRS = 0x00000040; - param->reg_DRV = 0x000000FA; - param->reg_IOZ = 0x00000034; - param->reg_DQIDLY = 0x00000074; - param->reg_FREQ = 0x00004DC0; - param->madj_max = 96; - param->dll2_finetune_step = 3; - break; - default: - case 396: - moutdwm(ast, 0x1E6E2020, 0x03F1); - param->wodt = 1; - param->rodt = 0; - param->reg_AC1 = 0x33302714; - param->reg_AC2 = 0xCC00B01B | trap_AC2; - param->reg_DQSIC = 0x000000E2; - param->reg_MRS = 0x00000C02 | trap_MRS; - param->reg_EMRS = 0x00000040; - param->reg_DRV = 0x000000FA; - param->reg_IOZ = 0x00000034; - param->reg_DQIDLY = 0x00000089; - param->reg_FREQ = 0x000050C0; - param->madj_max = 96; - param->dll2_finetune_step = 4; - - switch (param->dram_chipid) { - case AST_DRAM_512Mx16: - param->reg_AC2 = 0xCC00B016 | trap_AC2; - break; - default: - case AST_DRAM_1Gx16: - param->reg_AC2 = 0xCC00B01B | trap_AC2; - break; - case AST_DRAM_2Gx16: - param->reg_AC2 = 0xCC00B02B | trap_AC2; - break; - case AST_DRAM_4Gx16: - param->reg_AC2 = 0xCC00B03F | trap_AC2; - break; - } - - break; - - case 408: - moutdwm(ast, 0x1E6E2020, 0x01F0); - param->wodt = 1; - param->rodt = 0; - param->reg_AC1 = 0x33302714; - param->reg_AC2 = 0xCC00B01B | trap_AC2; - param->reg_DQSIC = 0x000000E2; - param->reg_MRS = 0x00000C02 | trap_MRS; - param->reg_EMRS = 0x00000040; - param->reg_DRV = 0x000000FA; - param->reg_IOZ = 0x00000034; - param->reg_DQIDLY = 0x00000089; - param->reg_FREQ = 0x000050C0; - param->madj_max = 96; - param->dll2_finetune_step = 4; - - switch (param->dram_chipid) { - case AST_DRAM_512Mx16: - param->reg_AC2 = 0xCC00B016 | trap_AC2; - break; - default: - case AST_DRAM_1Gx16: - param->reg_AC2 = 0xCC00B01B | trap_AC2; - break; - case AST_DRAM_2Gx16: - param->reg_AC2 = 0xCC00B02B | trap_AC2; - break; - case AST_DRAM_4Gx16: - param->reg_AC2 = 0xCC00B03F | trap_AC2; - break; - } - - break; - case 456: - moutdwm(ast, 0x1E6E2020, 0x0230); - param->wodt = 0; - param->reg_AC1 = 0x33302815; - param->reg_AC2 = 0xCD44B01E; - param->reg_DQSIC = 0x000000FC; - param->reg_MRS = 0x00000E72; - param->reg_EMRS = 0x00000000; - param->reg_DRV = 0x00000000; - param->reg_IOZ = 0x00000034; - param->reg_DQIDLY = 0x00000097; - param->reg_FREQ = 0x000052C0; - param->madj_max = 88; - param->dll2_finetune_step = 3; - break; - case 504: - moutdwm(ast, 0x1E6E2020, 0x0261); - param->wodt = 1; - param->rodt = 1; - param->reg_AC1 = 0x33302815; - param->reg_AC2 = 0xDE44C022; - param->reg_DQSIC = 0x00000117; - param->reg_MRS = 0x00000E72; - param->reg_EMRS = 0x00000040; - param->reg_DRV = 0x0000000A; - param->reg_IOZ = 0x00000045; - param->reg_DQIDLY = 0x000000A0; - param->reg_FREQ = 0x000054C0; - param->madj_max = 79; - param->dll2_finetune_step = 3; - break; - case 528: - moutdwm(ast, 0x1E6E2020, 0x0120); - param->wodt = 1; - param->rodt = 1; - param->reg_AC1 = 0x33302815; - param->reg_AC2 = 0xEF44D024; - param->reg_DQSIC = 0x00000125; - param->reg_MRS = 0x00000E72; - param->reg_EMRS = 0x00000004; - param->reg_DRV = 0x000000F9; - param->reg_IOZ = 0x00000045; - param->reg_DQIDLY = 0x000000A7; - param->reg_FREQ = 0x000055C0; - param->madj_max = 76; - param->dll2_finetune_step = 3; - break; - case 552: - moutdwm(ast, 0x1E6E2020, 0x02A1); - param->wodt = 1; - param->rodt = 1; - param->reg_AC1 = 0x43402915; - param->reg_AC2 = 0xFF44E025; - param->reg_DQSIC = 0x00000132; - param->reg_MRS = 0x00000E72; - param->reg_EMRS = 0x00000040; - param->reg_DRV = 0x0000000A; - param->reg_IOZ = 0x00000045; - param->reg_DQIDLY = 0x000000AD; - param->reg_FREQ = 0x000056C0; - param->madj_max = 76; - param->dll2_finetune_step = 3; - break; - case 576: - moutdwm(ast, 0x1E6E2020, 0x0140); - param->wodt = 1; - param->rodt = 1; - param->reg_AC1 = 0x43402915; - param->reg_AC2 = 0xFF44E027; - param->reg_DQSIC = 0x0000013F; - param->reg_MRS = 0x00000E72; - param->reg_EMRS = 0x00000004; - param->reg_DRV = 0x000000F5; - param->reg_IOZ = 0x00000045; - param->reg_DQIDLY = 0x000000B3; - param->reg_FREQ = 0x000057C0; - param->madj_max = 76; - param->dll2_finetune_step = 3; - break; - } - - switch (param->dram_chipid) { - case AST_DRAM_512Mx16: - param->dram_config = 0x100; - break; - default: - case AST_DRAM_1Gx16: - param->dram_config = 0x121; - break; - case AST_DRAM_2Gx16: - param->dram_config = 0x122; - break; - case AST_DRAM_4Gx16: - param->dram_config = 0x123; - break; - }; /* switch size */ - - switch (param->vram_size) { - default: - case AST_VIDMEM_SIZE_8M: - param->dram_config |= 0x00; - break; - case AST_VIDMEM_SIZE_16M: - param->dram_config |= 0x04; - break; - case AST_VIDMEM_SIZE_32M: - param->dram_config |= 0x08; - break; - case AST_VIDMEM_SIZE_64M: - param->dram_config |= 0x0c; - break; - } -} - -static void ddr2_init(struct ast_private *ast, struct ast2300_dram_param *param) -{ - u32 data, data2; - - moutdwm(ast, 0x1E6E0000, 0xFC600309); - moutdwm(ast, 0x1E6E0018, 0x00000100); - moutdwm(ast, 0x1E6E0024, 0x00000000); - moutdwm(ast, 0x1E6E0064, param->reg_MADJ); - moutdwm(ast, 0x1E6E0068, param->reg_SADJ); - udelay(10); - moutdwm(ast, 0x1E6E0064, param->reg_MADJ | 0xC0000); - udelay(10); - - moutdwm(ast, 0x1E6E0004, param->dram_config); - moutdwm(ast, 0x1E6E0008, 0x90040f); - moutdwm(ast, 0x1E6E0010, param->reg_AC1); - moutdwm(ast, 0x1E6E0014, param->reg_AC2); - moutdwm(ast, 0x1E6E0020, param->reg_DQSIC); - moutdwm(ast, 0x1E6E0080, 0x00000000); - moutdwm(ast, 0x1E6E0084, 0x00000000); - moutdwm(ast, 0x1E6E0088, param->reg_DQIDLY); - moutdwm(ast, 0x1E6E0018, 0x4040A130); - moutdwm(ast, 0x1E6E0018, 0x20402330); - moutdwm(ast, 0x1E6E0038, 0x00000000); - moutdwm(ast, 0x1E6E0040, 0xFF808000); - moutdwm(ast, 0x1E6E0044, 0x88848466); - moutdwm(ast, 0x1E6E0048, 0x44440008); - moutdwm(ast, 0x1E6E004C, 0x00000000); - moutdwm(ast, 0x1E6E0050, 0x80000000); - moutdwm(ast, 0x1E6E0050, 0x00000000); - moutdwm(ast, 0x1E6E0054, 0); - moutdwm(ast, 0x1E6E0060, param->reg_DRV); - moutdwm(ast, 0x1E6E006C, param->reg_IOZ); - moutdwm(ast, 0x1E6E0070, 0x00000000); - moutdwm(ast, 0x1E6E0074, 0x00000000); - moutdwm(ast, 0x1E6E0078, 0x00000000); - moutdwm(ast, 0x1E6E007C, 0x00000000); - - /* Wait MCLK2X lock to MCLK */ - do { - data = mindwm(ast, 0x1E6E001C); - } while (!(data & 0x08000000)); - moutdwm(ast, 0x1E6E0034, 0x00000001); - moutdwm(ast, 0x1E6E000C, 0x00005C04); - udelay(10); - moutdwm(ast, 0x1E6E000C, 0x00000000); - moutdwm(ast, 0x1E6E0034, 0x00000000); - data = mindwm(ast, 0x1E6E001C); - data = (data >> 8) & 0xff; - while ((data & 0x08) || ((data & 0x7) < 2) || (data < 4)) { - data2 = (mindwm(ast, 0x1E6E0064) & 0xfff3ffff) + 4; - if ((data2 & 0xff) > param->madj_max) { - break; - } - moutdwm(ast, 0x1E6E0064, data2); - if (data2 & 0x00100000) { - data2 = ((data2 & 0xff) >> 3) + 3; - } else { - data2 = ((data2 & 0xff) >> 2) + 5; - } - data = mindwm(ast, 0x1E6E0068) & 0xffff00ff; - data2 += data & 0xff; - data = data | (data2 << 8); - moutdwm(ast, 0x1E6E0068, data); - udelay(10); - moutdwm(ast, 0x1E6E0064, mindwm(ast, 0x1E6E0064) | 0xC0000); - udelay(10); - data = mindwm(ast, 0x1E6E0018) & 0xfffff1ff; - moutdwm(ast, 0x1E6E0018, data); - data = data | 0x200; - moutdwm(ast, 0x1E6E0018, data); - do { - data = mindwm(ast, 0x1E6E001C); - } while (!(data & 0x08000000)); - - moutdwm(ast, 0x1E6E0034, 0x00000001); - moutdwm(ast, 0x1E6E000C, 0x00005C04); - udelay(10); - moutdwm(ast, 0x1E6E000C, 0x00000000); - moutdwm(ast, 0x1E6E0034, 0x00000000); - data = mindwm(ast, 0x1E6E001C); - data = (data >> 8) & 0xff; - } - data = mindwm(ast, 0x1E6E0018) | 0xC00; - moutdwm(ast, 0x1E6E0018, data); - - moutdwm(ast, 0x1E6E0034, 0x00000001); - moutdwm(ast, 0x1E6E000C, 0x00000000); - udelay(50); - /* Mode Register Setting */ - moutdwm(ast, 0x1E6E002C, param->reg_MRS | 0x100); - moutdwm(ast, 0x1E6E0030, param->reg_EMRS); - moutdwm(ast, 0x1E6E0028, 0x00000005); - moutdwm(ast, 0x1E6E0028, 0x00000007); - moutdwm(ast, 0x1E6E0028, 0x00000003); - moutdwm(ast, 0x1E6E0028, 0x00000001); - - moutdwm(ast, 0x1E6E000C, 0x00005C08); - moutdwm(ast, 0x1E6E002C, param->reg_MRS); - moutdwm(ast, 0x1E6E0028, 0x00000001); - moutdwm(ast, 0x1E6E0030, param->reg_EMRS | 0x380); - moutdwm(ast, 0x1E6E0028, 0x00000003); - moutdwm(ast, 0x1E6E0030, param->reg_EMRS); - moutdwm(ast, 0x1E6E0028, 0x00000003); - - moutdwm(ast, 0x1E6E000C, 0x7FFF5C01); - data = 0; - if (param->wodt) { - data = 0x500; - } - if (param->rodt) { - data = data | 0x3000 | ((param->reg_AC2 & 0x60000) >> 3); - } - moutdwm(ast, 0x1E6E0034, data | 0x3); - moutdwm(ast, 0x1E6E0120, param->reg_FREQ); - - /* Wait DQI delay lock */ - do { - data = mindwm(ast, 0x1E6E0080); - } while (!(data & 0x40000000)); - /* Wait DQSI delay lock */ - do { - data = mindwm(ast, 0x1E6E0020); - } while (!(data & 0x00000800)); - /* Calibrate the DQSI delay */ - cbr_dll2(ast, param); - - /* ECC Memory Initialization */ -#ifdef ECC - moutdwm(ast, 0x1E6E007C, 0x00000000); - moutdwm(ast, 0x1E6E0070, 0x221); - do { - data = mindwm(ast, 0x1E6E0070); - } while (!(data & 0x00001000)); - moutdwm(ast, 0x1E6E0070, 0x00000000); - moutdwm(ast, 0x1E6E0050, 0x80000000); - moutdwm(ast, 0x1E6E0050, 0x00000000); -#endif - -} - -static void ast_init_dram_2300(struct drm_device *dev) -{ - struct ast_private *ast = dev->dev_private; - struct ast2300_dram_param param; - u32 temp; - u8 reg; - - reg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); - if ((reg & 0x80) == 0) {/* vga only */ - ast_write32(ast, 0xf004, 0x1e6e0000); - ast_write32(ast, 0xf000, 0x1); - ast_write32(ast, 0x12000, 0x1688a8a8); - do { - ; - } while (ast_read32(ast, 0x12000) != 0x1); - - ast_write32(ast, 0x10000, 0xfc600309); - do { - ; - } while (ast_read32(ast, 0x10000) != 0x1); - - /* Slow down CPU/AHB CLK in VGA only mode */ - temp = ast_read32(ast, 0x12008); - temp |= 0x73; - ast_write32(ast, 0x12008, temp); - - param.dram_type = AST_DDR3; - if (temp & 0x01000000) - param.dram_type = AST_DDR2; - param.dram_chipid = ast->dram_type; - param.dram_freq = ast->mclk; - param.vram_size = ast->vram_size; - - if (param.dram_type == AST_DDR3) { - get_ddr3_info(ast, ¶m); - ddr3_init(ast, ¶m); - } else { - get_ddr2_info(ast, ¶m); - ddr2_init(ast, ¶m); - } - - temp = mindwm(ast, 0x1e6e2040); - moutdwm(ast, 0x1e6e2040, temp | 0x40); - } - - /* wait ready */ - do { - reg = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xd0, 0xff); - } while ((reg & 0x40) == 0); -} - diff --git a/trunk/drivers/gpu/drm/ast/ast_tables.h b/trunk/drivers/gpu/drm/ast/ast_tables.h deleted file mode 100644 index 95fa6aba26bc..000000000000 --- a/trunk/drivers/gpu/drm/ast/ast_tables.h +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (c) 2005 ASPEED Technology Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the authors not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The authors makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -/* Ported from xf86-video-ast driver */ - -#ifndef AST_TABLES_H -#define AST_TABLES_H - -/* Std. Table Index Definition */ -#define TextModeIndex 0 -#define EGAModeIndex 1 -#define VGAModeIndex 2 -#define HiCModeIndex 3 -#define TrueCModeIndex 4 - -#define Charx8Dot 0x00000001 -#define HalfDCLK 0x00000002 -#define DoubleScanMode 0x00000004 -#define LineCompareOff 0x00000008 -#define SyncPP 0x00000000 -#define SyncPN 0x00000040 -#define SyncNP 0x00000080 -#define SyncNN 0x000000C0 -#define HBorder 0x00000020 -#define VBorder 0x00000010 -#define WideScreenMode 0x00000100 - - -/* DCLK Index */ -#define VCLK25_175 0x00 -#define VCLK28_322 0x01 -#define VCLK31_5 0x02 -#define VCLK36 0x03 -#define VCLK40 0x04 -#define VCLK49_5 0x05 -#define VCLK50 0x06 -#define VCLK56_25 0x07 -#define VCLK65 0x08 -#define VCLK75 0x09 -#define VCLK78_75 0x0A -#define VCLK94_5 0x0B -#define VCLK108 0x0C -#define VCLK135 0x0D -#define VCLK157_5 0x0E -#define VCLK162 0x0F -/* #define VCLK193_25 0x10 */ -#define VCLK154 0x10 -#define VCLK83_5 0x11 -#define VCLK106_5 0x12 -#define VCLK146_25 0x13 -#define VCLK148_5 0x14 - -static struct ast_vbios_dclk_info dclk_table[] = { - {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */ - {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */ - {0x67, 0x63, 0x01}, /* 02: VCLK31_5 */ - {0x76, 0x63, 0x01}, /* 03: VCLK36 */ - {0xEE, 0x67, 0x01}, /* 04: VCLK40 */ - {0x82, 0x62, 0x01}, /* 05: VCLK49_5 */ - {0xC6, 0x64, 0x01}, /* 06: VCLK50 */ - {0x94, 0x62, 0x01}, /* 07: VCLK56_25 */ - {0x80, 0x64, 0x00}, /* 08: VCLK65 */ - {0x7B, 0x63, 0x00}, /* 09: VCLK75 */ - {0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */ - {0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */ - {0x8E, 0x62, 0x00}, /* 0C: VCLK108 */ - {0x85, 0x24, 0x00}, /* 0D: VCLK135 */ - {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */ - {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ - {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */ - {0xa7, 0x78, 0x80}, /* 11: VCLK83.5 */ - {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ - {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ - {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */ -}; - -static struct ast_vbios_stdtable vbios_stdtable[] = { - /* MD_2_3_400 */ - { - 0x67, - {0x00,0x03,0x00,0x02}, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f, - 0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00, - 0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x0c,0x00,0x0f,0x08}, - {0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00, - 0xff} - }, - /* Mode12/ExtEGATable */ - { - 0xe3, - {0x01,0x0f,0x00,0x06}, - {0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07, - 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f, - 0x01,0x00,0x0f,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} - }, - /* ExtVGATable */ - { - 0x2f, - {0x01,0x0f,0x00,0x0e}, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x01,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f, - 0xff} - }, - /* ExtHiCTable */ - { - 0x2f, - {0x01,0x0f,0x00,0x0e}, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x01,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} - }, - /* ExtTrueCTable */ - { - 0x2f, - {0x01,0x0f,0x00,0x0e}, - {0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e, - 0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00, - 0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3, - 0xff}, - {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x01,0x00,0x00,0x00}, - {0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f, - 0xff} - }, -}; - -static struct ast_vbios_enhtable res_640x480[] = { - { 800, 640, 8, 96, 525, 480, 2, 2, VCLK25_175, /* 60Hz */ - (SyncNN | HBorder | VBorder | Charx8Dot), 60, 1, 0x2E }, - { 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5, /* 72Hz */ - (SyncNN | HBorder | VBorder | Charx8Dot), 72, 2, 0x2E }, - { 840, 640, 16, 64, 500, 480, 1, 3, VCLK31_5, /* 75Hz */ - (SyncNN | Charx8Dot) , 75, 3, 0x2E }, - { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* 85Hz */ - (SyncNN | Charx8Dot) , 85, 4, 0x2E }, - { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* end */ - (SyncNN | Charx8Dot) , 0xFF, 4, 0x2E }, -}; - -static struct ast_vbios_enhtable res_800x600[] = { - {1024, 800, 24, 72, 625, 600, 1, 2, VCLK36, /* 56Hz */ - (SyncPP | Charx8Dot), 56, 1, 0x30 }, - {1056, 800, 40, 128, 628, 600, 1, 4, VCLK40, /* 60Hz */ - (SyncPP | Charx8Dot), 60, 2, 0x30 }, - {1040, 800, 56, 120, 666, 600, 37, 6, VCLK50, /* 72Hz */ - (SyncPP | Charx8Dot), 72, 3, 0x30 }, - {1056, 800, 16, 80, 625, 600, 1, 3, VCLK49_5, /* 75Hz */ - (SyncPP | Charx8Dot), 75, 4, 0x30 }, - {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* 85Hz */ - (SyncPP | Charx8Dot), 84, 5, 0x30 }, - {1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* end */ - (SyncPP | Charx8Dot), 0xFF, 5, 0x30 }, -}; - - -static struct ast_vbios_enhtable res_1024x768[] = { - {1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65, /* 60Hz */ - (SyncNN | Charx8Dot), 60, 1, 0x31 }, - {1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75, /* 70Hz */ - (SyncNN | Charx8Dot), 70, 2, 0x31 }, - {1312, 1024, 16, 96, 800, 768, 1, 3, VCLK78_75, /* 75Hz */ - (SyncPP | Charx8Dot), 75, 3, 0x31 }, - {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* 85Hz */ - (SyncPP | Charx8Dot), 84, 4, 0x31 }, - {1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* end */ - (SyncPP | Charx8Dot), 0xFF, 4, 0x31 }, -}; - -static struct ast_vbios_enhtable res_1280x1024[] = { - {1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108, /* 60Hz */ - (SyncPP | Charx8Dot), 60, 1, 0x32 }, - {1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135, /* 75Hz */ - (SyncPP | Charx8Dot), 75, 2, 0x32 }, - {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* 85Hz */ - (SyncPP | Charx8Dot), 85, 3, 0x32 }, - {1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* end */ - (SyncPP | Charx8Dot), 0xFF, 3, 0x32 }, -}; - -static struct ast_vbios_enhtable res_1600x1200[] = { - {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* 60Hz */ - (SyncPP | Charx8Dot), 60, 1, 0x33 }, - {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* end */ - (SyncPP | Charx8Dot), 0xFF, 1, 0x33 }, -}; - -static struct ast_vbios_enhtable res_1920x1200[] = { - {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */ - (SyncNP | Charx8Dot), 60, 1, 0x34 }, - {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz */ - (SyncNP | Charx8Dot), 0xFF, 1, 0x34 }, -}; - -/* 16:10 */ -static struct ast_vbios_enhtable res_1280x800[] = { - {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 60, 1, 0x35 }, - {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 0xFF, 1, 0x35 }, - -}; - -static struct ast_vbios_enhtable res_1440x900[] = { - {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 60, 1, 0x36 }, - {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 0xFF, 1, 0x36 }, -}; - -static struct ast_vbios_enhtable res_1680x1050[] = { - {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 60, 1, 0x37 }, - {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */ - (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode), 0xFF, 1, 0x37 }, -}; - -/* HDTV */ -static struct ast_vbios_enhtable res_1920x1080[] = { - {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode), 60, 1, 0x38 }, - {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */ - (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode), 0xFF, 1, 0x38 }, -}; -#endif diff --git a/trunk/drivers/gpu/drm/ast/ast_ttm.c b/trunk/drivers/gpu/drm/ast/ast_ttm.c deleted file mode 100644 index 6cf2adea66bc..000000000000 --- a/trunk/drivers/gpu/drm/ast/ast_ttm.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright 2012 Red Hat Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - */ -/* - * Authors: Dave Airlie - */ -#include "drmP.h" -#include "ast_drv.h" -#include - -static inline struct ast_private * -ast_bdev(struct ttm_bo_device *bd) -{ - return container_of(bd, struct ast_private, ttm.bdev); -} - -static int -ast_ttm_mem_global_init(struct drm_global_reference *ref) -{ - return ttm_mem_global_init(ref->object); -} - -static void -ast_ttm_mem_global_release(struct drm_global_reference *ref) -{ - ttm_mem_global_release(ref->object); -} - -static int ast_ttm_global_init(struct ast_private *ast) -{ - struct drm_global_reference *global_ref; - int r; - - global_ref = &ast->ttm.mem_global_ref; - global_ref->global_type = DRM_GLOBAL_TTM_MEM; - global_ref->size = sizeof(struct ttm_mem_global); - global_ref->init = &ast_ttm_mem_global_init; - global_ref->release = &ast_ttm_mem_global_release; - r = drm_global_item_ref(global_ref); - if (r != 0) { - DRM_ERROR("Failed setting up TTM memory accounting " - "subsystem.\n"); - return r; - } - - ast->ttm.bo_global_ref.mem_glob = - ast->ttm.mem_global_ref.object; - global_ref = &ast->ttm.bo_global_ref.ref; - global_ref->global_type = DRM_GLOBAL_TTM_BO; - global_ref->size = sizeof(struct ttm_bo_global); - global_ref->init = &ttm_bo_global_init; - global_ref->release = &ttm_bo_global_release; - r = drm_global_item_ref(global_ref); - if (r != 0) { - DRM_ERROR("Failed setting up TTM BO subsystem.\n"); - drm_global_item_unref(&ast->ttm.mem_global_ref); - return r; - } - return 0; -} - -void -ast_ttm_global_release(struct ast_private *ast) -{ - if (ast->ttm.mem_global_ref.release == NULL) - return; - - drm_global_item_unref(&ast->ttm.bo_global_ref.ref); - drm_global_item_unref(&ast->ttm.mem_global_ref); - ast->ttm.mem_global_ref.release = NULL; -} - - -static void ast_bo_ttm_destroy(struct ttm_buffer_object *tbo) -{ - struct ast_bo *bo; - - bo = container_of(tbo, struct ast_bo, bo); - - drm_gem_object_release(&bo->gem); - kfree(bo); -} - -bool ast_ttm_bo_is_ast_bo(struct ttm_buffer_object *bo) -{ - if (bo->destroy == &ast_bo_ttm_destroy) - return true; - return false; -} - -static int -ast_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, - struct ttm_mem_type_manager *man) -{ - switch (type) { - case TTM_PL_SYSTEM: - man->flags = TTM_MEMTYPE_FLAG_MAPPABLE; - man->available_caching = TTM_PL_MASK_CACHING; - man->default_caching = TTM_PL_FLAG_CACHED; - break; - case TTM_PL_VRAM: - man->func = &ttm_bo_manager_func; - man->flags = TTM_MEMTYPE_FLAG_FIXED | - TTM_MEMTYPE_FLAG_MAPPABLE; - man->available_caching = TTM_PL_FLAG_UNCACHED | - TTM_PL_FLAG_WC; - man->default_caching = TTM_PL_FLAG_WC; - break; - default: - DRM_ERROR("Unsupported memory type %u\n", (unsigned)type); - return -EINVAL; - } - return 0; -} - -static void -ast_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl) -{ - struct ast_bo *astbo = ast_bo(bo); - - if (!ast_ttm_bo_is_ast_bo(bo)) - return; - - ast_ttm_placement(astbo, TTM_PL_FLAG_SYSTEM); - *pl = astbo->placement; -} - -static int ast_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp) -{ - return 0; -} - -static int ast_ttm_io_mem_reserve(struct ttm_bo_device *bdev, - struct ttm_mem_reg *mem) -{ - struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; - struct ast_private *ast = ast_bdev(bdev); - - mem->bus.addr = NULL; - mem->bus.offset = 0; - mem->bus.size = mem->num_pages << PAGE_SHIFT; - mem->bus.base = 0; - mem->bus.is_iomem = false; - if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE)) - return -EINVAL; - switch (mem->mem_type) { - case TTM_PL_SYSTEM: - /* system memory */ - return 0; - case TTM_PL_VRAM: - mem->bus.offset = mem->start << PAGE_SHIFT; - mem->bus.base = pci_resource_start(ast->dev->pdev, 0); - mem->bus.is_iomem = true; - break; - default: - return -EINVAL; - break; - } - return 0; -} - -static void ast_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) -{ -} - -static int ast_bo_move(struct ttm_buffer_object *bo, - bool evict, bool interruptible, - bool no_wait_reserve, bool no_wait_gpu, - struct ttm_mem_reg *new_mem) -{ - int r; - r = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); - return r; -} - - -static void ast_ttm_backend_destroy(struct ttm_tt *tt) -{ - ttm_tt_fini(tt); - kfree(tt); -} - -static struct ttm_backend_func ast_tt_backend_func = { - .destroy = &ast_ttm_backend_destroy, -}; - - -struct ttm_tt *ast_ttm_tt_create(struct ttm_bo_device *bdev, - unsigned long size, uint32_t page_flags, - struct page *dummy_read_page) -{ - struct ttm_tt *tt; - - tt = kzalloc(sizeof(struct ttm_tt), GFP_KERNEL); - if (tt == NULL) - return NULL; - tt->func = &ast_tt_backend_func; - if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) { - kfree(tt); - return NULL; - } - return tt; -} - -static int ast_ttm_tt_populate(struct ttm_tt *ttm) -{ - return ttm_pool_populate(ttm); -} - -static void ast_ttm_tt_unpopulate(struct ttm_tt *ttm) -{ - ttm_pool_unpopulate(ttm); -} - -struct ttm_bo_driver ast_bo_driver = { - .ttm_tt_create = ast_ttm_tt_create, - .ttm_tt_populate = ast_ttm_tt_populate, - .ttm_tt_unpopulate = ast_ttm_tt_unpopulate, - .init_mem_type = ast_bo_init_mem_type, - .evict_flags = ast_bo_evict_flags, - .move = ast_bo_move, - .verify_access = ast_bo_verify_access, - .io_mem_reserve = &ast_ttm_io_mem_reserve, - .io_mem_free = &ast_ttm_io_mem_free, -}; - -int ast_mm_init(struct ast_private *ast) -{ - int ret; - struct drm_device *dev = ast->dev; - struct ttm_bo_device *bdev = &ast->ttm.bdev; - - ret = ast_ttm_global_init(ast); - if (ret) - return ret; - - ret = ttm_bo_device_init(&ast->ttm.bdev, - ast->ttm.bo_global_ref.ref.object, - &ast_bo_driver, DRM_FILE_PAGE_OFFSET, - true); - if (ret) { - DRM_ERROR("Error initialising bo driver; %d\n", ret); - return ret; - } - - ret = ttm_bo_init_mm(bdev, TTM_PL_VRAM, - ast->vram_size >> PAGE_SHIFT); - if (ret) { - DRM_ERROR("Failed ttm VRAM init: %d\n", ret); - return ret; - } - - ast->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 0), - pci_resource_len(dev->pdev, 0), - DRM_MTRR_WC); - - return 0; -} - -void ast_mm_fini(struct ast_private *ast) -{ - struct drm_device *dev = ast->dev; - ttm_bo_device_release(&ast->ttm.bdev); - - ast_ttm_global_release(ast); - - if (ast->fb_mtrr >= 0) { - drm_mtrr_del(ast->fb_mtrr, - pci_resource_start(dev->pdev, 0), - pci_resource_len(dev->pdev, 0), DRM_MTRR_WC); - ast->fb_mtrr = -1; - } -} - -void ast_ttm_placement(struct ast_bo *bo, int domain) -{ - u32 c = 0; - bo->placement.fpfn = 0; - bo->placement.lpfn = 0; - bo->placement.placement = bo->placements; - bo->placement.busy_placement = bo->placements; - if (domain & TTM_PL_FLAG_VRAM) - bo->placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM; - if (domain & TTM_PL_FLAG_SYSTEM) - bo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; - if (!c) - bo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; - bo->placement.num_placement = c; - bo->placement.num_busy_placement = c; -} - -int ast_bo_reserve(struct ast_bo *bo, bool no_wait) -{ - int ret; - - ret = ttm_bo_reserve(&bo->bo, true, no_wait, false, 0); - if (ret) { - if (ret != -ERESTARTSYS) - DRM_ERROR("reserve failed %p\n", bo); - return ret; - } - return 0; -} - -void ast_bo_unreserve(struct ast_bo *bo) -{ - ttm_bo_unreserve(&bo->bo); -} - -int ast_bo_create(struct drm_device *dev, int size, int align, - uint32_t flags, struct ast_bo **pastbo) -{ - struct ast_private *ast = dev->dev_private; - struct ast_bo *astbo; - size_t acc_size; - int ret; - - astbo = kzalloc(sizeof(struct ast_bo), GFP_KERNEL); - if (!astbo) - return -ENOMEM; - - ret = drm_gem_object_init(dev, &astbo->gem, size); - if (ret) { - kfree(astbo); - return ret; - } - - astbo->gem.driver_private = NULL; - astbo->bo.bdev = &ast->ttm.bdev; - - ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); - - acc_size = ttm_bo_dma_acc_size(&ast->ttm.bdev, size, - sizeof(struct ast_bo)); - - ret = ttm_bo_init(&ast->ttm.bdev, &astbo->bo, size, - ttm_bo_type_device, &astbo->placement, - align >> PAGE_SHIFT, 0, false, NULL, acc_size, - NULL, ast_bo_ttm_destroy); - if (ret) - return ret; - - *pastbo = astbo; - return 0; -} - -static inline u64 ast_bo_gpu_offset(struct ast_bo *bo) -{ - return bo->bo.offset; -} - -int ast_bo_pin(struct ast_bo *bo, u32 pl_flag, u64 *gpu_addr) -{ - int i, ret; - - if (bo->pin_count) { - bo->pin_count++; - if (gpu_addr) - *gpu_addr = ast_bo_gpu_offset(bo); - } - - ast_ttm_placement(bo, pl_flag); - for (i = 0; i < bo->placement.num_placement; i++) - bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; - ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); - if (ret) - return ret; - - bo->pin_count = 1; - if (gpu_addr) - *gpu_addr = ast_bo_gpu_offset(bo); - return 0; -} - -int ast_bo_unpin(struct ast_bo *bo) -{ - int i, ret; - if (!bo->pin_count) { - DRM_ERROR("unpin bad %p\n", bo); - return 0; - } - bo->pin_count--; - if (bo->pin_count) - return 0; - - for (i = 0; i < bo->placement.num_placement ; i++) - bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT; - ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); - if (ret) - return ret; - - return 0; -} - -int ast_bo_push_sysram(struct ast_bo *bo) -{ - int i, ret; - if (!bo->pin_count) { - DRM_ERROR("unpin bad %p\n", bo); - return 0; - } - bo->pin_count--; - if (bo->pin_count) - return 0; - - if (bo->kmap.virtual) - ttm_bo_kunmap(&bo->kmap); - - ast_ttm_placement(bo, TTM_PL_FLAG_SYSTEM); - for (i = 0; i < bo->placement.num_placement ; i++) - bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; - - ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); - if (ret) { - DRM_ERROR("pushing to VRAM failed\n"); - return ret; - } - return 0; -} - -int ast_mmap(struct file *filp, struct vm_area_struct *vma) -{ - struct drm_file *file_priv; - struct ast_private *ast; - - if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) - return drm_mmap(filp, vma); - - file_priv = filp->private_data; - ast = file_priv->minor->dev->dev_private; - return ttm_bo_mmap(filp, vma, &ast->ttm.bdev); -} diff --git a/trunk/drivers/gpu/drm/cirrus/Kconfig b/trunk/drivers/gpu/drm/cirrus/Kconfig deleted file mode 100644 index fc154dd75296..000000000000 --- a/trunk/drivers/gpu/drm/cirrus/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -config DRM_CIRRUS_QEMU - tristate "Cirrus driver for QEMU emulated device" - depends on DRM && PCI && EXPERIMENTAL - select FB_SYS_FILLRECT - select FB_SYS_COPYAREA - select FB_SYS_IMAGEBLIT - select DRM_KMS_HELPER - select DRM_TTM - help - This is a KMS driver for emulated cirrus device in qemu. - It is *NOT* intended for real cirrus devices. This requires - the modesetting userspace X.org driver. diff --git a/trunk/drivers/gpu/drm/cirrus/Makefile b/trunk/drivers/gpu/drm/cirrus/Makefile deleted file mode 100644 index 69ffe7006d55..000000000000 --- a/trunk/drivers/gpu/drm/cirrus/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -ccflags-y := -Iinclude/drm -cirrus-y := cirrus_main.o cirrus_mode.o \ - cirrus_drv.o cirrus_fbdev.o cirrus_ttm.o - -obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o diff --git a/trunk/drivers/gpu/drm/cirrus/cirrus_drv.c b/trunk/drivers/gpu/drm/cirrus/cirrus_drv.c deleted file mode 100644 index d7038230b71e..000000000000 --- a/trunk/drivers/gpu/drm/cirrus/cirrus_drv.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2012 Red Hat - * - * This file is subject to the terms and conditions of the GNU General - * Public License version 2. See the file COPYING in the main - * directory of this archive for more details. - * - * Authors: Matthew Garrett - * Dave Airlie - */ -#include -#include -#include "drmP.h" -#include "drm.h" - -#include "cirrus_drv.h" - -int cirrus_modeset = -1; - -MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); -module_param_named(modeset, cirrus_modeset, int, 0400); - -/* - * This is the generic driver code. This binds the driver to the drm core, - * which then performs further device association and calls our graphics init - * functions - */ - -static struct drm_driver driver; - -/* only bind to the cirrus chip in qemu */ -static DEFINE_PCI_DEVICE_TABLE(pciidlist) = { - { PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, 0x1af4, 0x1100, 0, - 0, 0 }, - {0,} -}; - -static int __devinit -cirrus_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - return drm_get_pci_dev(pdev, ent, &driver); -} - -static void cirrus_pci_remove(struct pci_dev *pdev) -{ - struct drm_device *dev = pci_get_drvdata(pdev); - - drm_put_dev(dev); -} - -static const struct file_operations cirrus_driver_fops = { - .owner = THIS_MODULE, - .open = drm_open, - .release = drm_release, - .unlocked_ioctl = drm_ioctl, - .mmap = cirrus_mmap, - .poll = drm_poll, - .fasync = drm_fasync, -}; -static struct drm_driver driver = { - .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_USE_MTRR, - .load = cirrus_driver_load, - .unload = cirrus_driver_unload, - .fops = &cirrus_driver_fops, - .name = DRIVER_NAME, - .desc = DRIVER_DESC, - .date = DRIVER_DATE, - .major = DRIVER_MAJOR, - .minor = DRIVER_MINOR, - .patchlevel = DRIVER_PATCHLEVEL, - .gem_init_object = cirrus_gem_init_object, - .gem_free_object = cirrus_gem_free_object, - .dumb_create = cirrus_dumb_create, - .dumb_map_offset = cirrus_dumb_mmap_offset, - .dumb_destroy = cirrus_dumb_destroy, -}; - -static struct pci_driver cirrus_pci_driver = { - .name = DRIVER_NAME, - .id_table = pciidlist, - .probe = cirrus_pci_probe, - .remove = cirrus_pci_remove, -}; - -static int __init cirrus_init(void) -{ -#ifdef CONFIG_VGA_CONSOLE - if (vgacon_text_force() && cirrus_modeset == -1) - return -EINVAL; -#endif - - if (cirrus_modeset == 0) - return -EINVAL; - return drm_pci_init(&driver, &cirrus_pci_driver); -} - -static void __exit cirrus_exit(void) -{ - drm_pci_exit(&driver, &cirrus_pci_driver); -} - -module_init(cirrus_init); -module_exit(cirrus_exit); - -MODULE_DEVICE_TABLE(pci, pciidlist); -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/gpu/drm/cirrus/cirrus_drv.h b/trunk/drivers/gpu/drm/cirrus/cirrus_drv.h deleted file mode 100644 index 21bdfa8836f7..000000000000 --- a/trunk/drivers/gpu/drm/cirrus/cirrus_drv.h +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright 2012 Red Hat - * - * This file is subject to the terms and conditions of the GNU General - * Public License version 2. See the file COPYING in the main - * directory of this archive for more details. - * - * Authors: Matthew Garrett - * Dave Airlie - */ -#ifndef __CIRRUS_DRV_H__ -#define __CIRRUS_DRV_H__ - -#include