Skip to content

Commit 0a7f04b

Browse files
committed
drm/ast: Move DDC code to ast_ddc.{c,h}
Rename ast_i2c.c to ast_ddc.c and move its interface into the new header ast_ddc.h. Update all include statements as necessary and change the adapter name to 'AST DDC bus'. This avoids including I2C headers in the driver's main header file, which doesn't need them. Renaming files to _ddc indicates that the code is about the DDC. I2C is really just the underlying bus here. 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-6-tzimmermann@suse.de
1 parent e14ab30 commit 0a7f04b

5 files changed

Lines changed: 32 additions & 15 deletions

File tree

drivers/gpu/drm/ast/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
# Makefile for the drm device driver. This driver provides support for the
44
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
55

6-
ast-y := ast_drv.o ast_i2c.o ast_main.o ast_mm.o ast_mode.o ast_post.o ast_dp501.o ast_dp.o
6+
ast-y := \
7+
ast_ddc.o \
8+
ast_dp501.o \
9+
ast_dp.o \
10+
ast_drv.o \
11+
ast_main.o \
12+
ast_mm.o \
13+
ast_mode.o \
14+
ast_post.o
715

816
obj-$(CONFIG_DRM_AST) := ast.o
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <drm/drm_managed.h>
2525
#include <drm/drm_print.h>
2626

27+
#include "ast_ddc.h"
2728
#include "ast_drv.h"
2829

2930
static void ast_i2c_setsda(void *i2c_priv, int data)
@@ -122,8 +123,7 @@ struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev)
122123
i2c->adapter.dev.parent = dev->dev;
123124
i2c->dev = dev;
124125
i2c_set_adapdata(&i2c->adapter, i2c);
125-
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
126-
"AST i2c bit bus");
126+
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), "AST DDC bus");
127127
i2c->adapter.algo_data = &i2c->bit;
128128

129129
i2c->bit.udelay = 20;

drivers/gpu/drm/ast/ast_ddc.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: MIT */
2+
3+
#ifndef __AST_DDC_H__
4+
#define __AST_DDC_H__
5+
6+
#include <linux/i2c.h>
7+
#include <linux/i2c-algo-bit.h>
8+
9+
struct drm_device;
10+
11+
struct ast_i2c_chan {
12+
struct i2c_adapter adapter;
13+
struct drm_device *dev;
14+
struct i2c_algo_bit_data bit;
15+
};
16+
17+
struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev);
18+
19+
#endif

drivers/gpu/drm/ast/ast_drv.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#ifndef __AST_DRV_H__
2929
#define __AST_DRV_H__
3030

31-
#include <linux/i2c.h>
32-
#include <linux/i2c-algo-bit.h>
3331
#include <linux/io.h>
3432
#include <linux/types.h>
3533

@@ -149,15 +147,9 @@ static inline struct ast_plane *to_ast_plane(struct drm_plane *plane)
149147
}
150148

151149
/*
152-
* Connector with i2c channel
150+
* BMC
153151
*/
154152

155-
struct ast_i2c_chan {
156-
struct i2c_adapter adapter;
157-
struct drm_device *dev;
158-
struct i2c_algo_bit_data bit;
159-
};
160-
161153
struct ast_bmc_connector {
162154
struct drm_connector base;
163155
struct drm_connector *physical_connector;
@@ -476,9 +468,6 @@ bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata);
476468
u8 ast_get_dp501_max_clk(struct drm_device *dev);
477469
void ast_init_3rdtx(struct drm_device *dev);
478470

479-
/* ast_i2c.c */
480-
struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev);
481-
482471
/* aspeed DP */
483472
bool ast_astdp_is_connected(struct ast_device *ast);
484473
int ast_astdp_read_edid(struct drm_device *dev, u8 *ediddata);

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include <drm/drm_probe_helper.h>
4747
#include <drm/drm_simple_kms_helper.h>
4848

49+
#include "ast_ddc.h"
4950
#include "ast_drv.h"
5051
#include "ast_tables.h"
5152

0 commit comments

Comments
 (0)