bool is_tv;
/* This is for current tv format name */
- char *tv_format_name;
+ int tv_format_index;
/**
* This is set if we treat the device as HDMI, instead of DVI.
uint16_t output_flag;
/* This contains all current supported TV format */
- char *tv_format_supported[TV_FORMAT_NUM];
+ u8 tv_format_supported[TV_FORMAT_NUM];
int format_supported_num;
struct drm_property *tv_format_property;
struct drm_property *tv_format_name_property[TV_FORMAT_NUM];
static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo)
{
struct intel_sdvo_tv_format format;
- uint32_t format_map, i;
-
- for (i = 0; i < TV_FORMAT_NUM; i++)
- if (tv_format_names[i] == intel_sdvo->tv_format_name)
- break;
+ uint32_t format_map;
- format_map = 1 << i;
+ format_map = 1 << intel_sdvo->tv_format_index;
memset(&format, 0, sizeof(format));
memcpy(&format, &format_map, min(sizeof(format), sizeof(format_map)));
/* Read the list of supported input resolutions for the selected TV
* format.
*/
- for (i = 0; i < TV_FORMAT_NUM; i++)
- if (tv_format_names[i] == intel_sdvo->tv_format_name)
- break;
-
- format_map = (1 << i);
+ format_map = 1 << intel_sdvo->tv_format_index;
memcpy(&tv_res, &format_map,
min(sizeof(format_map), sizeof(struct intel_sdvo_sdtv_resolution_request)));
if (nmode)
drm_mode_probed_add(connector, nmode);
}
-
}
static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
if (val >= TV_FORMAT_NUM)
return -EINVAL;
- if (intel_sdvo->tv_format_name ==
+ if (intel_sdvo->tv_format_index ==
intel_sdvo_connector->tv_format_supported[val])
return 0;
- intel_sdvo->tv_format_name = intel_sdvo_connector->tv_format_supported[val];
+ intel_sdvo->tv_format_index = intel_sdvo_connector->tv_format_supported[val];
changed = true;
} else if (IS_TV_OR_LVDS(intel_sdvo_connector)) {
cmd = 0;
intel_sdvo_connector->format_supported_num = 0;
for (i = 0 ; i < TV_FORMAT_NUM; i++)
- if (format_map & (1 << i)) {
- intel_sdvo_connector->tv_format_supported
- [intel_sdvo_connector->format_supported_num++] =
- tv_format_names[i];
- }
+ if (format_map & (1 << i))
+ intel_sdvo_connector->tv_format_supported[intel_sdvo_connector->format_supported_num++] = i;
intel_sdvo_connector->tv_format_property =
for (i = 0; i < intel_sdvo_connector->format_supported_num; i++)
drm_property_add_enum(
intel_sdvo_connector->tv_format_property, i,
- i, intel_sdvo_connector->tv_format_supported[i]);
+ i, tv_format_names[intel_sdvo_connector->tv_format_supported[i]]);
- intel_sdvo->tv_format_name = intel_sdvo_connector->tv_format_supported[0];
+ intel_sdvo->tv_format_index = intel_sdvo_connector->tv_format_supported[0];
drm_connector_attach_property(&intel_sdvo_connector->base.base,
intel_sdvo_connector->tv_format_property, 0);
return true;