Skip to contentSkip to conversation

drm/radeon/kms: set i2c adapter class to I2C_CLASS_DDC

PATCH In review Alex Deucher 2 participants 4 messages May 3, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/radeon/kms: set i2c adapter class to I2C_CLASS_DDC

The most common use of the radeon i2c buses is for ddc.

---
 drivers/gpu/drm/radeon/radeon_i2c.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_i2c.c +2 -0
index 983cbac..781196d 100644
@@ -888,6 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
 
 	i2c->rec = *rec;
 	i2c->adapter.owner = THIS_MODULE;
+	i2c->adapter.class = I2C_CLASS_DDC;
 	i2c->dev = dev;
 	i2c_set_adapdata(&i2c->adapter, i2c);
 	if (rec->mm_i2c ||
@@ -947,6 +948,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
 
 	i2c->rec = *rec;
 	i2c->adapter.owner = THIS_MODULE;
+	i2c->adapter.class = I2C_CLASS_DDC;
 	i2c->dev = dev;
 	snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
 		 "Radeon aux bus %s", name);
Signature · 1 line
1.7.1.1
#1 lore raw

PATCH 2/2 drm/radeon/kms: add I2C_CLASS_HWMON to radeon i2c adapater classes

I'm not sure this is necessary. In most cases the driver will add the hwmon device itself based on information from the vbios tables. However, there are some boards without a proper vbios entry for the the hwmon chips and non-x86 (Mac/Sun) cards do not have a standard vbios. This allows the hwmon drivers to detect devices on the radeon i2c buses.

---
 drivers/gpu/drm/radeon/radeon_i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/radeon_i2c.c +1 -1
index 781196d..65d8744 100644
@@ -888,7 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
 
 	i2c->rec = *rec;
 	i2c->adapter.owner = THIS_MODULE;
-	i2c->adapter.class = I2C_CLASS_DDC;
+	i2c->adapter.class = I2C_CLASS_DDC | I2C_CLASS_HWMON;
 	i2c->dev = dev;
 	i2c_set_adapdata(&i2c->adapter, i2c);
 	if (rec->mm_i2c ||
Signature · 1 line
1.7.1.1
#2 lore raw

Re: [PATCH 2/2] drm/radeon/kms: add I2C_CLASS_HWMON to radeon i2c adapater classes

BenH doesn't want this for macs and that was mainly the use for this patch, so it (2/2) can be ignored.

Alex

Quoted 30 lines · Alex Deucher

I'm not sure this is necessary.  In most cases the driver will add the hwmon device itself based on information from the vbios tables.  However, there are some boards without a proper vbios entry for the the hwmon chips and non-x86 (Mac/Sun) cards do not have a standard vbios.  This allows the hwmon drivers to detect devices on the radeon i2c buses.

---
 drivers/gpu/drm/radeon/radeon_i2c.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/radeon_i2c.c +1 -1
index 781196d..65d8744 100644
@@ -888,7 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
 
        i2c->rec = *rec;
        i2c->adapter.owner = THIS_MODULE;
-       i2c->adapter.class = I2C_CLASS_DDC;
+       i2c->adapter.class = I2C_CLASS_DDC | I2C_CLASS_HWMON;
        i2c->dev = dev;
        i2c_set_adapdata(&i2c->adapter, i2c);

       if (rec->mm_i2c ||
--
1.7.1.1

Acked-by on v1 1/2
#3 lore raw
In reply to Alex Deucher
Quoted 4 lines · Alex Deucher

The most common use of the radeon i2c buses is for ddc.

Quoted 24 lines
---
 drivers/gpu/drm/radeon/radeon_i2c.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_i2c.c +2 -0
index 983cbac..781196d 100644
@@ -888,6 +888,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
 
 	i2c->rec = *rec;
 	i2c->adapter.owner = THIS_MODULE;
+	i2c->adapter.class = I2C_CLASS_DDC;
 	i2c->dev = dev;
 	i2c_set_adapdata(&i2c->adapter, i2c);
 	if (rec->mm_i2c ||
@@ -947,6 +948,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
 
 	i2c->rec = *rec;
 	i2c->adapter.owner = THIS_MODULE;
+	i2c->adapter.class = I2C_CLASS_DDC;
 	i2c->dev = dev;
 	snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
 		 "Radeon aux bus %s", name);
Signature · 1 line
Jean Delvare