On Wed, Dec 18, 2013 at 09:52:47AM +0100, Daniel Vetter wrote:
On Tue, Dec 17, 2013 at 05:20:07PM +0100, Thierry Reding wrote:
Implements an I2C-over-AUX I2C adapter on top of the generic drm_dp_aux infrastructure. It extracts the retry logic from existing drivers, which should help in porting those drivers to this new helper.
Signed-off-by: Thierry Reding treding@nvidia.com
drivers/gpu/drm/drm_dp_helper.c | 178 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_dp_helper.h | 4 + 2 files changed, 182 insertions(+)
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 01a8173c6e83..8a64cf8ac8cc 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -555,3 +555,181 @@ int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link)
return 0; }
+/*
- I2C-over-AUX implementation
- */
+struct drm_dp_i2c_adapter {
- struct i2c_adapter adapter;
- struct drm_dp_aux *aux;
+};
I'd just embedded an i2c adapter into the drm_dp_aux structure - I think drivers always want such a thing. Then maybe rename the setup function from add to register_i2c_bus or so. For smoother transition drivers can always store a pointer to this i2c_adapter somewhere more convenient for them.
Okay, I've made that change. I was slightly worried that it might cause lifetime issues, but looking somewhat more closely perhaps that's not an issue since i2c_adapters seem to be carefully designed to easily allow being embedded.
Thierry