drm/i915: use __packed instead of __attribute__((packed))
Subsystems (2)
PATCH 1/2 drm/i915: use __packed instead of __attribute__((packed))
Checkpatch tells me
WARNING: __packed is preferred over __attribute__((packed))
so switch over to __packed across the driver before adding new packed structs.
Signed-off-by Jani Nikula <[email protected]>
--- drivers/gpu/drm/i915/intel_bios.h | 48 ++++++++++++++++---------------- drivers/gpu/drm/i915/intel_opregion.c | 8 +++--- drivers/gpu/drm/i915/intel_sdvo_regs.h | 40 +++++++++++++------------- 3 files changed, 48 insertions(+), 48 deletions(-)
drivers/gpu/drm/i915/intel_bios.h +24 -24
@@ -39,7 +39,7 @@ struct vbt_header {u8 reserved0;u32 bdb_offset;/**< from beginning of VBT */ u32 aim_offset[4 ];/**< from beginning of VBT */ -} __attribute__((packed)); +} __packed;struct bdb_header {u8 signature[16 ];/**< Always 'BIOS_DATA_BLOCK' */
@@ -65,7 +65,7 @@ struct vbios_data {u8 rsvd4;/* popup memory size */ u8 resize_pci_bios;u8 rsvd5;/* is crt already on ddc2 */ -} __attribute__((packed)); +} __packed;/* * There are several types of BIOS data blocks (BDBs), each block has
@@ -142,7 +142,7 @@ struct bdb_general_features { u8 dp_ssc_enb:1; /* PCH attached eDP supports SSC */ u8 dp_ssc_freq:1; /* SSC freq for PCH attached eDP */ u8 rsvd11:3; /* finish byte */ -} __attribute__((packed)); +} __packed;/* pre-915 */ #define GPIO_PIN_DVI_LVDS 0x03/* "DVI/LVDS DDC GPIO pins" */
@@ -225,7 +225,7 @@ struct old_child_dev_config {u8 dvo2_wiring;u16 extended_type;u8 dvo_function; -} __attribute__((packed)); +} __packed;/* This one contains field offsets that are known to be common for all BDB * versions. Notice that the meaning of the contents contents may still change,
@@ -238,7 +238,7 @@ struct common_child_dev_config {u8 not_common2[2 ];u8 ddc_pin;u16 edid_ptr; -} __attribute__((packed)); +} __packed;/* This field changes depending on the BDB version, so the most reliable way to * read it is by checking the BDB version and reading the raw pointer. */
@@ -279,7 +279,7 @@ struct bdb_general_definitions {* sizeof(child_device_config); */ union child_device_config devices[0 ]; -} __attribute__((packed)); +} __packed;struct bdb_lvds_options {u8 panel_type;
@@ -293,7 +293,7 @@ struct bdb_lvds_options { u8 lvds_edid:1; u8 rsvd2:1;u8 rsvd4; -} __attribute__((packed)); +} __packed;/* LFP pointer table contains entries to the struct below */ struct bdb_lvds_lfp_data_ptr {
@@ -303,12 +303,12 @@ struct bdb_lvds_lfp_data_ptr {u8 dvo_table_size;u16 panel_pnp_id_offset;u8 pnp_table_size; -} __attribute__((packed)); +} __packed;struct bdb_lvds_lfp_data_ptrs {u8 lvds_entries;/* followed by one or more lvds_data_ptr structs */ struct bdb_lvds_lfp_data_ptr ptr[16 ]; -} __attribute__((packed)); +} __packed;/* LFP data has 3 blocks per entry */ struct lvds_fp_timing {
@@ -325,7 +325,7 @@ struct lvds_fp_timing {u32 pfit_reg;u32 pfit_reg_val;u16 terminator; -} __attribute__((packed)); +} __packed;struct lvds_dvo_timing {u16 clock;/**< In 10khz */
@@ -353,7 +353,7 @@ struct lvds_dvo_timing { u8 vsync_positive:1; u8 hsync_positive:1; u8 rsvd2:1; -} __attribute__((packed)); +} __packed;struct lvds_pnp_id {u16 mfg_name;
@@ -361,17 +361,17 @@ struct lvds_pnp_id {u32 serial;u8 mfg_week;u8 mfg_year; -} __attribute__((packed)); +} __packed;struct bdb_lvds_lfp_data_entry {struct lvds_fp_timing fp_timing;struct lvds_dvo_timing dvo_timing;struct lvds_pnp_id pnp_id; -} __attribute__((packed)); +} __packed;struct bdb_lvds_lfp_data {struct bdb_lvds_lfp_data_entry data[16 ]; -} __attribute__((packed)); +} __packed;struct aimdb_header {char signature[16 ];
@@ -379,12 +379,12 @@ struct aimdb_header {u16 aimdb_version;u16 aimdb_header_size;u16 aimdb_size; -} __attribute__((packed)); +} __packed;struct aimdb_block {u8 aimdb_id;u16 aimdb_size; -} __attribute__((packed)); +} __packed;struct vch_panel_data {u16 fp_timing_offset;
@@ -395,12 +395,12 @@ struct vch_panel_data {u8 text_fitting_size;u16 graphics_fitting_offset;u8 graphics_fitting_size; -} __attribute__((packed)); +} __packed;struct vch_bdb_22 {struct aimdb_block aimdb_block;struct vch_panel_data panels[16 ]; -} __attribute__((packed)); +} __packed;struct bdb_sdvo_lvds_options {u8 panel_backlight;
@@ -416,7 +416,7 @@ struct bdb_sdvo_lvds_options {u8 panel_misc_bits_2;u8 panel_misc_bits_3;u8 panel_misc_bits_4; -} __attribute__((packed)); +} __packed;#define BDB_DRIVER_FEATURE_NO_LVDS 0
@@ -462,7 +462,7 @@ struct bdb_driver_features {u8 hdmi_termination;u8 custom_vbt_version; -} __attribute__((packed)); +} __packed;#define EDP_18BPP 0#define EDP_24BPP 1
@@ -487,14 +487,14 @@ struct edp_power_seq {u16 t9;u16 t10;u16 t11_t12; -} __attribute__ ((packed)); +} __packed;struct edp_link_params {u8 rate:4 ;u8 lanes:4 ;u8 preemphasis:4 ;u8 vswing:4 ; -} __attribute__ ((packed)); +} __packed;struct bdb_edp {struct edp_power_seq power_seqs[16 ];
@@ -505,7 +505,7 @@ struct bdb_edp {/* ith bit indicates enabled/disabled for (i+1)th panel */ u16 edp_s3d_feature;u16 edp_t3_optimization; -} __attribute__ ((packed)); +} __packed;void intel_setup_bios (struct drm_device *dev);int intel_parse_bios (struct drm_device *dev);
@@ -733,6 +733,6 @@ struct bdb_mipi {u32 hl_switch_cnt;u32 lp_byte_clk; u32 clk_lane_switch_cnt; -} __attribute__((packed)); +} __packed;#endif /* _I830_BIOS_H_ */
drivers/gpu/drm/i915/intel_opregion.c +4 -4
@@ -64,7 +64,7 @@ struct opregion_header {u8 driver_ver[16 ];u32 mboxes;u8 reserved[164 ]; -} __attribute__((packed)); +} __packed;/* OpRegion mailbox #1: public ACPI methods */ struct opregion_acpi {
@@ -86,7 +86,7 @@ struct opregion_acpi {u32 cnot;/* current OS notification */ u32 nrdy;/* driver status */ u8 rsvd2[60 ]; -} __attribute__((packed)); +} __packed;/* OpRegion mailbox #2: SWSCI */ struct opregion_swsci {
@@ -94,7 +94,7 @@ struct opregion_swsci {u32 parm;/* command parameters */ u32 dslp;/* driver sleep time-out */ u8 rsvd[244 ]; -} __attribute__((packed)); +} __packed;/* OpRegion mailbox #3: ASLE */ struct opregion_asle {
@@ -115,7 +115,7 @@ struct opregion_asle {u32 srot;/* supported rotation angles */ u32 iuer;/* IUER events */ u8 rsvd[86 ]; -} __attribute__((packed)); +} __packed;/* Driver readiness indicator */ #define ASLE_ARDY_READY (1 << 0)
drivers/gpu/drm/i915/intel_sdvo_regs.h +20 -20
@@ -59,7 +59,7 @@ struct intel_sdvo_caps { unsigned int stall_support:1; unsigned int pad:1;u16 output_flags; -} __attribute__((packed)); +} __packed;/* Note: SDVO detailed timing flags match EDID misc flags. */ #define DTD_FLAG_HSYNC_POSITIVE (1 << 1)
@@ -94,12 +94,12 @@ struct intel_sdvo_dtd {u8 v_sync_off_high;u8 reserved; } part2; -} __attribute__((packed)); +} __packed;struct intel_sdvo_pixel_clock_range {u16 min;/**< pixel clock, in 10kHz units */ u16 max;/**< pixel clock, in 10kHz units */ -} __attribute__((packed)); +} __packed;struct intel_sdvo_preferred_input_timing_args {u16 clock;
@@ -108,7 +108,7 @@ struct intel_sdvo_preferred_input_timing_args { u8 interlace:1; u8 scaled:1; u8 pad:6; -} __attribute__((packed)); +} __packed;/* I2C registers for SDVO */ #define SDVO_I2C_ARG_0 0x07
@@ -162,7 +162,7 @@ struct intel_sdvo_get_trained_inputs_response { unsigned int input0_trained:1; unsigned int input1_trained:1; unsigned int pad:6; -} __attribute__((packed)); +} __packed;/** Returns a struct intel_sdvo_output_flags of active outputs. */ #define SDVO_CMD_GET_ACTIVE_OUTPUTS 0x04
@@ -219,7 +219,7 @@ struct intel_sdvo_get_interrupt_event_source_response { unsigned int ambient_light_interrupt:1; unsigned int hdmi_audio_encrypt_change:1; unsigned int pad:6; -} __attribute__((packed)); +} __packed;/** * Selects which input is affected by future input commands.
@@ -232,7 +232,7 @@ struct intel_sdvo_get_interrupt_event_source_response {struct intel_sdvo_set_target_input_args {unsigned int target_1:1 ;unsigned int pad:7 ; -} __attribute__((packed)); +} __packed;/** * Takes a struct intel_sdvo_output_flags of which outputs are targeted by
@@ -370,7 +370,7 @@ struct intel_sdvo_tv_format { unsigned int hdtv_std_eia_7702a_480i_60:1; unsigned int hdtv_std_eia_7702a_480p_60:1; unsigned int pad:3; -} __attribute__((packed)); +} __packed;#define SDVO_CMD_GET_TV_FORMAT 0x28
@@ -401,7 +401,7 @@ struct intel_sdvo_sdtv_resolution_request { unsigned int secam_l:1; unsigned int secam_60:1; unsigned int pad:5; -} __attribute__((packed)); +} __packed;struct intel_sdvo_sdtv_resolution_reply {unsigned int res_320x200:1 ;
@@ -426,7 +426,7 @@ struct intel_sdvo_sdtv_resolution_reply { unsigned int res_1024x768:1; unsigned int res_1280x1024:1; unsigned int pad:5; -} __attribute__((packed)); +} __packed;/* Get supported resolution with squire pixel aspect ratio that can be scaled for the requested HDTV format */
@@ -463,7 +463,7 @@ struct intel_sdvo_hdtv_resolution_request { unsigned int hdtv_std_eia_7702a_480i_60:1; unsigned int hdtv_std_eia_7702a_480p_60:1; unsigned int pad:6; -} __attribute__((packed)); +} __packed;struct intel_sdvo_hdtv_resolution_reply {unsigned int res_640x480:1 ;
@@ -517,7 +517,7 @@ struct intel_sdvo_hdtv_resolution_reply { unsigned int res_1280x768:1; unsigned int pad5:7; -} __attribute__((packed)); +} __packed;/* Get supported power state returns info for encoder and monitor, rely on last SetTargetInput and SetTargetOutput calls */
@@ -557,13 +557,13 @@ struct sdvo_panel_power_sequencing { unsigned int t4_high:2; unsigned int pad:6; -} __attribute__((packed)); +} __packed;#define SDVO_CMD_GET_MAX_BACKLIGHT_LEVEL 0x30struct sdvo_max_backlight_reply {u8 max_value;u8 default_value; -} __attribute__((packed)); +} __packed;#define SDVO_CMD_GET_BACKLIGHT_LEVEL 0x31#define SDVO_CMD_SET_BACKLIGHT_LEVEL 0x32
@@ -573,14 +573,14 @@ struct sdvo_get_ambient_light_reply {u16 trip_low;u16 trip_high;u16 value; -} __attribute__((packed)); +} __packed;#define SDVO_CMD_SET_AMBIENT_LIGHT 0x34struct sdvo_set_ambient_light_reply {u16 trip_low;u16 trip_high;unsigned int enable:1 ;unsigned int pad:7 ; -} __attribute__((packed)); +} __packed;/* Set display power state */ #define SDVO_CMD_SET_DISPLAY_POWER_STATE 0x7d
@@ -608,7 +608,7 @@ struct intel_sdvo_enhancements_reply { unsigned int dither:1; unsigned int tv_chroma_filter:1; unsigned int tv_luma_filter:1; -} __attribute__((packed)); +} __packed;/* Picture enhancement limits below are dependent on the current TV format, * and thus need to be queried and set after it.
@@ -630,7 +630,7 @@ struct intel_sdvo_enhancements_reply {struct intel_sdvo_enhancement_limits_reply {u16 max_value;u16 default_value; -} __attribute__((packed)); +} __packed;#define SDVO_CMD_GET_LVDS_PANEL_INFORMATION 0x7f#define SDVO_CMD_SET_LVDS_PANEL_INFORMATION 0x80
@@ -671,7 +671,7 @@ struct intel_sdvo_enhancement_limits_reply {#define SDVO_CMD_SET_TV_LUMA_FILTER 0x79struct intel_sdvo_enhancements_arg {u16 value; -} __attribute__((packed)); +} __packed;#define SDVO_CMD_GET_DOT_CRAWL 0x70#define SDVO_CMD_SET_DOT_CRAWL 0x71
@@ -727,4 +727,4 @@ struct intel_sdvo_enhancements_arg {struct intel_sdvo_encode {u8 dvi_rev;u8 hdmi_rev; -} __attribute__ ((packed)); +} __packed;
Signature · 1 line
1.7.9.5
PATCH 2/2 drm/i915: parse backlight modulation frequency from the BIOS VBT
We don't actually do anything with the information yet, but parse and log what's in the VBT.
Signed-off-by Jani Nikula <[email protected]>
--- drivers/gpu/drm/i915/i915_drv.h | 5 +++++ drivers/gpu/drm/i915/intel_bios.c | 29 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_bios.h | 16 ++++++++++++++++ 3 files changed, 50 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +5 -0
@@ -1163,6 +1163,11 @@ struct intel_vbt_data {int edp_bpp;struct edp_power_seq edp_pps; +struct { +u16 pwm_freq_hz; +bool active_low_pwm; + } backlight; +/* MIPI DSI */ struct {u16 panel_id;
drivers/gpu/drm/i915/intel_bios.c +29 -0
@@ -281,6 +281,34 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv, } } +static void +parse_lfp_backlight (struct drm_i915_private *dev_priv,struct bdb_header *bdb) +{ +const struct bdb_lfp_backlight_data *backlight_data; +const struct bdb_lfp_backlight_data_entry *entry; + + backlight_data =find_section (bdb,BDB_LVDS_BACKLIGHT ); +if (!backlight_data) +return ; + +if (backlight_data->entry_size !=sizeof (backlight_data->data[0 ])) { +DRM_DEBUG_KMS ("Unsupported backlight data entry size %u\n" , + backlight_data->entry_size); +return ; + } + + entry = &backlight_data->data[panel_type]; + + dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; + dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm; +DRM_DEBUG_KMS ("VBT backlight PWM modulation frequency %u Hz, " +"active %s, min brightness %u, level %u\n" , + dev_priv->vbt.backlight.pwm_freq_hz, + dev_priv->vbt.backlight.active_low_pwm ?"low" :"high" , + entry->min_brightness, + backlight_data->level[panel_type]); +} +/* Try to find sdvo panel data */ static void parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
@@ -889,6 +917,7 @@ intel_parse_bios(struct drm_device *dev)parse_general_features (dev_priv, bdb);parse_general_definitions (dev_priv, bdb);parse_lfp_panel_data (dev_priv, bdb); +parse_lfp_backlight (dev_priv, bdb);parse_sdvo_panel_data (dev_priv, bdb);parse_sdvo_device_mapping (dev_priv, bdb);parse_device_mapping (dev_priv, bdb);
drivers/gpu/drm/i915/intel_bios.h +16 -0
@@ -373,6 +373,22 @@ struct bdb_lvds_lfp_data {struct bdb_lvds_lfp_data_entry data[16 ]; } __packed; +struct bdb_lfp_backlight_data_entry { +u8 type:2 ; +u8 active_low_pwm:1 ; +u8 obsolete1:5 ; +u16 pwm_freq_hz; +u8 min_brightness; +u8 obsolete2; +u8 obsolete3; +} __packed; + +struct bdb_lfp_backlight_data { +u8 entry_size; +struct bdb_lfp_backlight_data_entry data[16 ]; +u8 level[16 ]; +} __packed; +struct aimdb_header {char signature[16 ];char oem_device[20 ];
Signature · 1 line
1.7.9.5