diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2024-03-25 23:06:51 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2024-04-02 11:40:47 +0300 |
commit | 42f4980da575ffbb1ff73bd8ffdd79662a23e8f6 (patch) | |
tree | 8e1a54fd90e3e5b5c467d4bb027f52f14c91a429 /drivers/gpu/drm/ast | |
parent | 0a7f04b433fc7c77d8c03eb6b2f32196a3d9b0c5 (diff) | |
download | linux-42f4980da575ffbb1ff73bd8ffdd79662a23e8f6.tar.xz |
drm/ast: Rename struct ast_i2c_chan to struct ast_ddc
The struct struct ast_i2c_chan represents the Display Data Channel
(DDC); I2C is the underlying bus. Rename the structure, the variables
and the helper ast_i2c_create() to ddc-like terms. No functional
changes.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240325200855.21150-7-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/ast')
-rw-r--r-- | drivers/gpu/drm/ast/ast_ddc.c | 71 | ||||
-rw-r--r-- | drivers/gpu/drm/ast/ast_ddc.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/ast/ast_mode.c | 24 |
3 files changed, 52 insertions, 47 deletions
diff --git a/drivers/gpu/drm/ast/ast_ddc.c b/drivers/gpu/drm/ast/ast_ddc.c index df604b4e9673..c0e5d03c028d 100644 --- a/drivers/gpu/drm/ast/ast_ddc.c +++ b/drivers/gpu/drm/ast/ast_ddc.c @@ -29,8 +29,8 @@ static void ast_i2c_setsda(void *i2c_priv, int data) { - struct ast_i2c_chan *i2c = i2c_priv; - struct ast_device *ast = to_ast_device(i2c->dev); + struct ast_ddc *ddc = i2c_priv; + struct ast_device *ast = to_ast_device(ddc->dev); int i; u8 ujcrb7, jtemp; @@ -45,8 +45,8 @@ static void ast_i2c_setsda(void *i2c_priv, int data) static void ast_i2c_setscl(void *i2c_priv, int clock) { - struct ast_i2c_chan *i2c = i2c_priv; - struct ast_device *ast = to_ast_device(i2c->dev); + struct ast_ddc *ddc = i2c_priv; + struct ast_device *ast = to_ast_device(ddc->dev); int i; u8 ujcrb7, jtemp; @@ -61,8 +61,8 @@ static void ast_i2c_setscl(void *i2c_priv, int clock) static int ast_i2c_getsda(void *i2c_priv) { - struct ast_i2c_chan *i2c = i2c_priv; - struct ast_device *ast = to_ast_device(i2c->dev); + struct ast_ddc *ddc = i2c_priv; + struct ast_device *ast = to_ast_device(ddc->dev); uint32_t val, val2, count, pass; count = 0; @@ -83,8 +83,8 @@ static int ast_i2c_getsda(void *i2c_priv) static int ast_i2c_getscl(void *i2c_priv) { - struct ast_i2c_chan *i2c = i2c_priv; - struct ast_device *ast = to_ast_device(i2c->dev); + struct ast_ddc *ddc = i2c_priv; + struct ast_device *ast = to_ast_device(ddc->dev); uint32_t val, val2, count, pass; count = 0; @@ -103,45 +103,50 @@ static int ast_i2c_getscl(void *i2c_priv) return val & 1 ? 1 : 0; } -static void ast_i2c_release(struct drm_device *dev, void *res) +static void ast_ddc_release(struct drm_device *dev, void *res) { - struct ast_i2c_chan *i2c = res; + struct ast_ddc *ddc = res; - i2c_del_adapter(&i2c->adapter); + i2c_del_adapter(&ddc->adapter); } -struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev) +struct ast_ddc *ast_ddc_create(struct drm_device *dev) { - struct ast_i2c_chan *i2c; + struct ast_ddc *ddc; + struct i2c_adapter *adapter; + struct i2c_algo_bit_data *bit; int ret; - i2c = drmm_kzalloc(dev->dev, sizeof(*i2c), GFP_KERNEL); - if (!i2c) + ddc = drmm_kzalloc(dev, sizeof(*ddc), GFP_KERNEL); + if (!ddc) return ERR_PTR(-ENOMEM); - - i2c->adapter.owner = THIS_MODULE; - i2c->adapter.dev.parent = dev->dev; - i2c->dev = dev; - i2c_set_adapdata(&i2c->adapter, i2c); - snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), "AST DDC bus"); - i2c->adapter.algo_data = &i2c->bit; - - i2c->bit.udelay = 20; - i2c->bit.timeout = 2; - i2c->bit.data = i2c; - i2c->bit.setsda = ast_i2c_setsda; - i2c->bit.setscl = ast_i2c_setscl; - i2c->bit.getsda = ast_i2c_getsda; - i2c->bit.getscl = ast_i2c_getscl; - ret = i2c_bit_add_bus(&i2c->adapter); + ddc->dev = dev; + + adapter = &ddc->adapter; + adapter->owner = THIS_MODULE; + adapter->dev.parent = dev->dev; + i2c_set_adapdata(adapter, ddc); + snprintf(adapter->name, sizeof(adapter->name), "AST DDC bus"); + + bit = &ddc->bit; + bit->udelay = 20; + bit->timeout = 2; + bit->data = ddc; + bit->setsda = ast_i2c_setsda; + bit->setscl = ast_i2c_setscl; + bit->getsda = ast_i2c_getsda; + bit->getscl = ast_i2c_getscl; + + adapter->algo_data = bit; + ret = i2c_bit_add_bus(adapter); if (ret) { drm_err(dev, "Failed to register bit i2c\n"); return ERR_PTR(ret); } - ret = drmm_add_action_or_reset(dev, ast_i2c_release, i2c); + ret = drmm_add_action_or_reset(dev, ast_ddc_release, ddc); if (ret) return ERR_PTR(ret); - return i2c; + return ddc; } diff --git a/drivers/gpu/drm/ast/ast_ddc.h b/drivers/gpu/drm/ast/ast_ddc.h index 244666fd6c53..071f9be3e27d 100644 --- a/drivers/gpu/drm/ast/ast_ddc.h +++ b/drivers/gpu/drm/ast/ast_ddc.h @@ -8,12 +8,12 @@ struct drm_device; -struct ast_i2c_chan { +struct ast_ddc { struct i2c_adapter adapter; struct drm_device *dev; struct i2c_algo_bit_data bit; }; -struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev); +struct ast_ddc *ast_ddc_create(struct drm_device *dev); #endif diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index bdef2160726e..40cb495acc90 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -1388,18 +1388,18 @@ static const struct drm_connector_funcs ast_vga_connector_funcs = { static int ast_vga_connector_init(struct drm_device *dev, struct drm_connector *connector) { - struct ast_i2c_chan *i2c; + struct ast_ddc *ddc; int ret; - i2c = ast_i2c_create(dev); - if (IS_ERR(i2c)) { - ret = PTR_ERR(i2c); - drm_err(dev, "failed to add ddc bus for connector; ret=%d\n", ret); + ddc = ast_ddc_create(dev); + if (IS_ERR(ddc)) { + ret = PTR_ERR(ddc); + drm_err(dev, "failed to add DDC bus for connector; ret=%d\n", ret); return ret; } ret = drm_connector_init_with_ddc(dev, connector, &ast_vga_connector_funcs, - DRM_MODE_CONNECTOR_VGA, &i2c->adapter); + DRM_MODE_CONNECTOR_VGA, &ddc->adapter); if (ret) return ret; @@ -1485,18 +1485,18 @@ static const struct drm_connector_funcs ast_sil164_connector_funcs = { static int ast_sil164_connector_init(struct drm_device *dev, struct drm_connector *connector) { - struct ast_i2c_chan *i2c; + struct ast_ddc *ddc; int ret; - i2c = ast_i2c_create(dev); - if (IS_ERR(i2c)) { - ret = PTR_ERR(i2c); - drm_err(dev, "failed to add ddc bus for connector; ret=%d\n", ret); + ddc = ast_ddc_create(dev); + if (IS_ERR(ddc)) { + ret = PTR_ERR(ddc); + drm_err(dev, "failed to add DDC bus for connector; ret=%d\n", ret); return ret; } ret = drm_connector_init_with_ddc(dev, connector, &ast_sil164_connector_funcs, - DRM_MODE_CONNECTOR_DVII, &i2c->adapter); + DRM_MODE_CONNECTOR_DVII, &ddc->adapter); if (ret) return ret; |