diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-02-06 04:58:18 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-02-09 05:15:25 -0500 |
commit | d9bc3c02e36d844c2d980e65ddda5c7699e073f8 (patch) | |
tree | 95de33796245ca8c4e7629ddf22629bcc89f1403 /drivers/gpu/drm/i915 | |
parent | 4a67d39190315558631d944b1cea4466ed4c86d8 (diff) |
drm: add convenience function to create an range property
Creating a range property is a common pattern, so create
a convenience function for this and use it where appropriate.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index e334ec33a47d..80acc3f241ef 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -2277,10 +2277,8 @@ static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo, | |||
2277 | intel_sdvo_connector->max_##name = data_value[0]; \ | 2277 | intel_sdvo_connector->max_##name = data_value[0]; \ |
2278 | intel_sdvo_connector->cur_##name = response; \ | 2278 | intel_sdvo_connector->cur_##name = response; \ |
2279 | intel_sdvo_connector->name = \ | 2279 | intel_sdvo_connector->name = \ |
2280 | drm_property_create(dev, DRM_MODE_PROP_RANGE, #name, 2); \ | 2280 | drm_property_create_range(dev, 0, #name, 0, data_value[0]); \ |
2281 | if (!intel_sdvo_connector->name) return false; \ | 2281 | if (!intel_sdvo_connector->name) return false; \ |
2282 | intel_sdvo_connector->name->values[0] = 0; \ | ||
2283 | intel_sdvo_connector->name->values[1] = data_value[0]; \ | ||
2284 | drm_connector_attach_property(connector, \ | 2282 | drm_connector_attach_property(connector, \ |
2285 | intel_sdvo_connector->name, \ | 2283 | intel_sdvo_connector->name, \ |
2286 | intel_sdvo_connector->cur_##name); \ | 2284 | intel_sdvo_connector->cur_##name); \ |
@@ -2314,25 +2312,19 @@ intel_sdvo_create_enhance_property_tv(struct intel_sdvo *intel_sdvo, | |||
2314 | intel_sdvo_connector->left_margin = data_value[0] - response; | 2312 | intel_sdvo_connector->left_margin = data_value[0] - response; |
2315 | intel_sdvo_connector->right_margin = intel_sdvo_connector->left_margin; | 2313 | intel_sdvo_connector->right_margin = intel_sdvo_connector->left_margin; |
2316 | intel_sdvo_connector->left = | 2314 | intel_sdvo_connector->left = |
2317 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2315 | drm_property_create_range(dev, 0, "left_margin", 0, data_value[0]); |
2318 | "left_margin", 2); | ||
2319 | if (!intel_sdvo_connector->left) | 2316 | if (!intel_sdvo_connector->left) |
2320 | return false; | 2317 | return false; |
2321 | 2318 | ||
2322 | intel_sdvo_connector->left->values[0] = 0; | ||
2323 | intel_sdvo_connector->left->values[1] = data_value[0]; | ||
2324 | drm_connector_attach_property(connector, | 2319 | drm_connector_attach_property(connector, |
2325 | intel_sdvo_connector->left, | 2320 | intel_sdvo_connector->left, |
2326 | intel_sdvo_connector->left_margin); | 2321 | intel_sdvo_connector->left_margin); |
2327 | 2322 | ||
2328 | intel_sdvo_connector->right = | 2323 | intel_sdvo_connector->right = |
2329 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2324 | drm_property_create_range(dev, 0, "right_margin", 0, data_value[0]); |
2330 | "right_margin", 2); | ||
2331 | if (!intel_sdvo_connector->right) | 2325 | if (!intel_sdvo_connector->right) |
2332 | return false; | 2326 | return false; |
2333 | 2327 | ||
2334 | intel_sdvo_connector->right->values[0] = 0; | ||
2335 | intel_sdvo_connector->right->values[1] = data_value[0]; | ||
2336 | drm_connector_attach_property(connector, | 2328 | drm_connector_attach_property(connector, |
2337 | intel_sdvo_connector->right, | 2329 | intel_sdvo_connector->right, |
2338 | intel_sdvo_connector->right_margin); | 2330 | intel_sdvo_connector->right_margin); |
@@ -2356,25 +2348,21 @@ intel_sdvo_create_enhance_property_tv(struct intel_sdvo *intel_sdvo, | |||
2356 | intel_sdvo_connector->top_margin = data_value[0] - response; | 2348 | intel_sdvo_connector->top_margin = data_value[0] - response; |
2357 | intel_sdvo_connector->bottom_margin = intel_sdvo_connector->top_margin; | 2349 | intel_sdvo_connector->bottom_margin = intel_sdvo_connector->top_margin; |
2358 | intel_sdvo_connector->top = | 2350 | intel_sdvo_connector->top = |
2359 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2351 | drm_property_create_range(dev, 0, |
2360 | "top_margin", 2); | 2352 | "top_margin", 0, data_value[0]); |
2361 | if (!intel_sdvo_connector->top) | 2353 | if (!intel_sdvo_connector->top) |
2362 | return false; | 2354 | return false; |
2363 | 2355 | ||
2364 | intel_sdvo_connector->top->values[0] = 0; | ||
2365 | intel_sdvo_connector->top->values[1] = data_value[0]; | ||
2366 | drm_connector_attach_property(connector, | 2356 | drm_connector_attach_property(connector, |
2367 | intel_sdvo_connector->top, | 2357 | intel_sdvo_connector->top, |
2368 | intel_sdvo_connector->top_margin); | 2358 | intel_sdvo_connector->top_margin); |
2369 | 2359 | ||
2370 | intel_sdvo_connector->bottom = | 2360 | intel_sdvo_connector->bottom = |
2371 | drm_property_create(dev, DRM_MODE_PROP_RANGE, | 2361 | drm_property_create_range(dev, 0, |
2372 | "bottom_margin", 2); | 2362 | "bottom_margin", 0, data_value[0]); |
2373 | if (!intel_sdvo_connector->bottom) | 2363 | if (!intel_sdvo_connector->bottom) |
2374 | return false; | 2364 | return false; |
2375 | 2365 | ||
2376 | intel_sdvo_connector->bottom->values[0] = 0; | ||
2377 | intel_sdvo_connector->bottom->values[1] = data_value[0]; | ||
2378 | drm_connector_attach_property(connector, | 2366 | drm_connector_attach_property(connector, |
2379 | intel_sdvo_connector->bottom, | 2367 | intel_sdvo_connector->bottom, |
2380 | intel_sdvo_connector->bottom_margin); | 2368 | intel_sdvo_connector->bottom_margin); |
@@ -2403,12 +2391,10 @@ intel_sdvo_create_enhance_property_tv(struct intel_sdvo *intel_sdvo, | |||
2403 | intel_sdvo_connector->max_dot_crawl = 1; | 2391 | intel_sdvo_connector->max_dot_crawl = 1; |
2404 | intel_sdvo_connector->cur_dot_crawl = response & 0x1; | 2392 | intel_sdvo_connector->cur_dot_crawl = response & 0x1; |
2405 | intel_sdvo_connector->dot_crawl = | 2393 | intel_sdvo_connector->dot_crawl = |
2406 | drm_property_create(dev, DRM_MODE_PROP_RANGE, "dot_crawl", 2); | 2394 | drm_property_create_range(dev, 0, "dot_crawl", 0, 1); |
2407 | if (!intel_sdvo_connector->dot_crawl) | 2395 | if (!intel_sdvo_connector->dot_crawl) |
2408 | return false; | 2396 | return false; |
2409 | 2397 | ||
2410 | intel_sdvo_connector->dot_crawl->values[0] = 0; | ||
2411 | intel_sdvo_connector->dot_crawl->values[1] = 1; | ||
2412 | drm_connector_attach_property(connector, | 2398 | drm_connector_attach_property(connector, |
2413 | intel_sdvo_connector->dot_crawl, | 2399 | intel_sdvo_connector->dot_crawl, |
2414 | intel_sdvo_connector->cur_dot_crawl); | 2400 | intel_sdvo_connector->cur_dot_crawl); |