2019-05-30 07:57:49 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2011-11-04 02:22:15 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Intel Corporation
|
|
|
|
*
|
|
|
|
* Authers: Jesse Barnes <jesse.barnes@intel.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/i2c.h>
|
2019-05-20 03:55:26 +08:00
|
|
|
|
2011-11-04 02:22:15 +08:00
|
|
|
#include "psb_intel_drv.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* psb_intel_ddc_probe
|
|
|
|
*
|
|
|
|
*/
|
2011-12-20 05:40:05 +08:00
|
|
|
bool psb_intel_ddc_probe(struct i2c_adapter *adapter)
|
2011-11-04 02:22:15 +08:00
|
|
|
{
|
|
|
|
u8 out_buf[] = { 0x0, 0x0 };
|
|
|
|
u8 buf[2];
|
|
|
|
int ret;
|
|
|
|
struct i2c_msg msgs[] = {
|
|
|
|
{
|
|
|
|
.addr = 0x50,
|
|
|
|
.flags = 0,
|
|
|
|
.len = 1,
|
|
|
|
.buf = out_buf,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.addr = 0x50,
|
|
|
|
.flags = I2C_M_RD,
|
|
|
|
.len = 1,
|
|
|
|
.buf = buf,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-12-20 05:40:05 +08:00
|
|
|
ret = i2c_transfer(adapter, msgs, 2);
|
2011-11-04 02:22:15 +08:00
|
|
|
if (ret == 2)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* psb_intel_ddc_get_modes - get modelist from monitor
|
|
|
|
* @connector: DRM connector device to use
|
|
|
|
*
|
|
|
|
* Fetch the EDID information from @connector using the DDC bus.
|
|
|
|
*/
|
2011-12-20 05:40:05 +08:00
|
|
|
int psb_intel_ddc_get_modes(struct drm_connector *connector,
|
|
|
|
struct i2c_adapter *adapter)
|
2011-11-04 02:22:15 +08:00
|
|
|
{
|
|
|
|
struct edid *edid;
|
|
|
|
int ret = 0;
|
|
|
|
|
2011-12-20 05:40:05 +08:00
|
|
|
edid = drm_get_edid(connector, adapter);
|
2011-11-04 02:22:15 +08:00
|
|
|
if (edid) {
|
2018-07-09 16:40:06 +08:00
|
|
|
drm_connector_update_edid_property(connector, edid);
|
2011-12-20 05:40:05 +08:00
|
|
|
ret = drm_add_edid_modes(connector, edid);
|
2011-11-04 02:22:15 +08:00
|
|
|
kfree(edid);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|