mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
drm/radeon/kms/dce3+: add support for hw i2c using atom
Starting with DCE3 hardware, atom contains a general purpose ProcessI2cChannelTransaction similar to ProcessAuxChannelTransaction. Add an implementation using the atom tables for DCE3+ hardware. This should be a little less CPU intensive than bit banging and may work better in certain cases. Enable it by setting the radeon hw_i2c module parameter to 1. E.g., radeon.hw_i2c=1 on the kernel command line in grub. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
9048955748
commit
30388c6e48
3 changed files with 161 additions and 1 deletions
|
@ -30,6 +30,10 @@
|
|||
#include "radeon.h"
|
||||
#include "atom.h"
|
||||
|
||||
extern int radeon_atom_hw_i2c_xfer(struct i2c_adapter *i2c_adap,
|
||||
struct i2c_msg *msgs, int num);
|
||||
extern u32 radeon_atom_hw_i2c_func(struct i2c_adapter *adap);
|
||||
|
||||
/**
|
||||
* radeon_ddc_probe
|
||||
*
|
||||
|
@ -882,6 +886,11 @@ static const struct i2c_algorithm radeon_i2c_algo = {
|
|||
.functionality = radeon_hw_i2c_func,
|
||||
};
|
||||
|
||||
static const struct i2c_algorithm radeon_atom_i2c_algo = {
|
||||
.master_xfer = radeon_atom_hw_i2c_xfer,
|
||||
.functionality = radeon_atom_hw_i2c_func,
|
||||
};
|
||||
|
||||
struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
|
||||
struct radeon_i2c_bus_rec *rec,
|
||||
const char *name)
|
||||
|
@ -914,6 +923,18 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
|
|||
DRM_ERROR("Failed to register hw i2c %s\n", name);
|
||||
goto out_free;
|
||||
}
|
||||
} else if (rec->hw_capable &&
|
||||
radeon_hw_i2c &&
|
||||
ASIC_IS_DCE3(rdev)) {
|
||||
/* hw i2c using atom */
|
||||
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
|
||||
"Radeon i2c hw bus %s", name);
|
||||
i2c->adapter.algo = &radeon_atom_i2c_algo;
|
||||
ret = i2c_add_adapter(&i2c->adapter);
|
||||
if (ret) {
|
||||
DRM_ERROR("Failed to register hw i2c %s\n", name);
|
||||
goto out_free;
|
||||
}
|
||||
} else {
|
||||
/* set the radeon bit adapter */
|
||||
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue