23 #include <linux/i2c.h>
39 #define MRST_BLC_MAX_PWM_REG_FREQ 0xFFFF
40 #define BRIGHTNESS_MAX_LEVEL 100
62 if (dev_priv->
ops->lvds_bl_power)
63 dev_priv->
ops->lvds_bl_power(dev,
true);
65 if (dev_priv->
ops->lvds_bl_power)
66 dev_priv->
ops->lvds_bl_power(dev,
false);
71 }
while (pp_status &
PP_ON);
73 pm_request_idle(&dev->pdev->dev);
85 oaktrail_lvds_set_power(dev, psb_intel_encoder,
true);
87 oaktrail_lvds_set_power(dev, psb_intel_encoder,
false);
92 static void oaktrail_lvds_mode_set(
struct drm_encoder *encoder,
132 DRM_ERROR(
"Couldn't find connector when setting mode");
138 dev->mode_config.scaling_mode_property,
165 static void oaktrail_lvds_prepare(
struct drm_encoder *encoder)
169 struct psb_intel_encoder *psb_intel_encoder =
179 oaktrail_lvds_set_power(dev, psb_intel_encoder,
false);
183 static u32 oaktrail_lvds_get_max_backlight(
struct drm_device *dev)
195 ret = ((dev_priv->
regs.saveBLC_PWM_CTL &
202 static void oaktrail_lvds_commit(
struct drm_encoder *encoder)
206 struct psb_intel_encoder *psb_intel_encoder =
212 oaktrail_lvds_get_max_backlight(dev);
213 oaktrail_lvds_set_power(dev, psb_intel_encoder,
true);
217 .dpms = oaktrail_lvds_dpms,
219 .prepare = oaktrail_lvds_prepare,
220 .mode_set = oaktrail_lvds_mode_set,
221 .commit = oaktrail_lvds_commit,
227 846, 1056, 0, 480, 489, 491, 525, 0, 0) },
230 802, 1024, 0, 480, 481, 482, 525, 0, 0) },
233 1104, 1184, 0, 600, 603, 604, 608, 0, 0) },
236 1136, 1184, 0, 600, 603, 604, 608, 0, 0) },
239 1204, 1312, 0, 600, 607, 610, 621, 0, 0) },
242 1184, 1344, 0, 768, 771, 777, 806, 0, 0) },
245 1558, 1664, 0, 768, 769, 770, 776, 0, 0) },
250 static void oaktrail_lvds_get_configuration_mode(
struct drm_device *dev,
328 struct psb_intel_encoder *psb_intel_encoder;
337 psb_intel_encoder = kzalloc(
sizeof(
struct psb_intel_encoder),
GFP_KERNEL);
338 if (!psb_intel_encoder)
341 psb_intel_connector = kzalloc(
sizeof(
struct psb_intel_connector),
GFP_KERNEL);
342 if (!psb_intel_connector)
343 goto failed_connector;
345 connector = &psb_intel_connector->
base;
346 encoder = &psb_intel_encoder->
base;
359 drm_encoder_helper_add(encoder, &oaktrail_lvds_helper_funcs);
360 drm_connector_helper_add(connector,
367 dev->mode_config.scaling_mode_property,
391 if (i2c_adap ==
NULL)
392 dev_err(dev->dev,
"No ddc adapter available!\n");
418 oaktrail_lvds_get_configuration_mode(dev, mode_dev);
427 dev_err(dev->dev,
"Found no modes on the lvds, ignoring the LVDS\n");
436 dev_dbg(dev->dev,
"No LVDS modes found, disabling.\n");
437 if (psb_intel_encoder->
ddc_bus)
444 kfree(psb_intel_connector);
446 kfree(psb_intel_encoder);