2019-05-30 06:57:49 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2011-11-04 01:22:15 +07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Intel Corporation
|
|
|
|
*
|
|
|
|
* Authers: Jesse Barnes <jesse.barnes@intel.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <drm/drmP.h>
|
|
|
|
#include "psb_intel_drv.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* psb_intel_ddc_probe
|
|
|
|
*
|
|
|
|
*/
|
2011-12-20 04:40:05 +07:00
|
|
|
bool psb_intel_ddc_probe(struct i2c_adapter *adapter)
|
2011-11-04 01:22:15 +07: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 04:40:05 +07:00
|
|
|
ret = i2c_transfer(adapter, msgs, 2);
|
2011-11-04 01:22:15 +07: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 04:40:05 +07:00
|
|
|
int psb_intel_ddc_get_modes(struct drm_connector *connector,
|
|
|
|
struct i2c_adapter *adapter)
|
2011-11-04 01:22:15 +07:00
|
|
|
{
|
|
|
|
struct edid *edid;
|
|
|
|
int ret = 0;
|
|
|
|
|
2011-12-20 04:40:05 +07:00
|
|
|
edid = drm_get_edid(connector, adapter);
|
2011-11-04 01:22:15 +07:00
|
|
|
if (edid) {
|
2018-07-09 15:40:06 +07:00
|
|
|
drm_connector_update_edid_property(connector, edid);
|
2011-12-20 04:40:05 +07:00
|
|
|
ret = drm_add_edid_modes(connector, edid);
|
2011-11-04 01:22:15 +07:00
|
|
|
kfree(edid);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|