Skip to content

Commit 1f91373

Browse files
committed
Merge tag 'drm-misc-next-2024-04-05' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next
drm-misc-next for v6.10: Core Changes: - Fix DRM_DISPLAY_DP_HELPER dependencies. Driver Changes: - i2c and polling fixes to ast. - Small fixes to panthor. - Allow IRQ to share GPIO pins in bridge/adv7511. Signed-off-by: Dave Airlie <[email protected]> From: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents fee54d0 + d1ef8fc commit 1f91373

32 files changed

+356
-460
lines changed

Documentation/ABI/testing/sysfs-driver-panfrost-profiling

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Description:
77
Valid values are:
88
0: Don't enable fdinfo job profiling sources.
99
1: Enable fdinfo job profiling sources, this enables both the GPU's
10-
timestamp and cycle counter registers.
10+
timestamp and cycle counter registers.

Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ properties:
2222
enum:
2323
# Anberic RG353V-V2 5.0" 640x480 TFT LCD panel
2424
- anbernic,rg353v-panel-v2
25+
# GameForce Chi 3.5" 640x480 TFT LCD panel
26+
- gameforce,chi-panel
2527
# Powkiddy RGB10MAX3 5.0" 720x1280 TFT LCD panel
2628
- powkiddy,rgb10max3-panel
2729
# Powkiddy RGB30 3.0" 720x720 TFT LCD panel

Documentation/devicetree/bindings/vendor-prefixes.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,8 @@ patternProperties:
531531
description: FX Technology Ltd.
532532
"^galaxycore,.*":
533533
description: GalaxyCore Inc.
534+
"^gameforce,.*":
535+
description: GameForce
534536
"^gardena,.*":
535537
description: GARDENA GmbH
536538
"^gateway,.*":

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

drivers/gpu/drm/ast/ast_i2c.c renamed to drivers/gpu/drm/ast/ast_ddc.c

Lines changed: 73 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -24,44 +24,67 @@
2424
#include <drm/drm_managed.h>
2525
#include <drm/drm_print.h>
2626

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

29-
static void ast_i2c_setsda(void *i2c_priv, int data)
30+
static void ast_ddc_algo_bit_data_setsda(void *data, int state)
3031
{
31-
struct ast_i2c_chan *i2c = i2c_priv;
32-
struct ast_device *ast = to_ast_device(i2c->dev);
32+
struct ast_ddc *ddc = data;
33+
struct ast_device *ast = ddc->ast;
3334
int i;
3435
u8 ujcrb7, jtemp;
3536

3637
for (i = 0; i < 0x10000; i++) {
37-
ujcrb7 = ((data & 0x01) ? 0 : 1) << 2;
38+
ujcrb7 = ((state & 0x01) ? 0 : 1) << 2;
3839
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb7, 0xf1, ujcrb7);
3940
jtemp = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xb7, 0x04);
4041
if (ujcrb7 == jtemp)
4142
break;
4243
}
4344
}
4445

45-
static void ast_i2c_setscl(void *i2c_priv, int clock)
46+
static void ast_ddc_algo_bit_data_setscl(void *data, int state)
4647
{
47-
struct ast_i2c_chan *i2c = i2c_priv;
48-
struct ast_device *ast = to_ast_device(i2c->dev);
48+
struct ast_ddc *ddc = data;
49+
struct ast_device *ast = ddc->ast;
4950
int i;
5051
u8 ujcrb7, jtemp;
5152

5253
for (i = 0; i < 0x10000; i++) {
53-
ujcrb7 = ((clock & 0x01) ? 0 : 1);
54+
ujcrb7 = ((state & 0x01) ? 0 : 1);
5455
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb7, 0xf4, ujcrb7);
5556
jtemp = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xb7, 0x01);
5657
if (ujcrb7 == jtemp)
5758
break;
5859
}
5960
}
6061

61-
static int ast_i2c_getsda(void *i2c_priv)
62+
static int ast_ddc_algo_bit_data_pre_xfer(struct i2c_adapter *adapter)
6263
{
63-
struct ast_i2c_chan *i2c = i2c_priv;
64-
struct ast_device *ast = to_ast_device(i2c->dev);
64+
struct ast_ddc *ddc = i2c_get_adapdata(adapter);
65+
struct ast_device *ast = ddc->ast;
66+
67+
/*
68+
* Protect access to I/O registers from concurrent modesetting
69+
* by acquiring the I/O-register lock.
70+
*/
71+
mutex_lock(&ast->modeset_lock);
72+
73+
return 0;
74+
}
75+
76+
static void ast_ddc_algo_bit_data_post_xfer(struct i2c_adapter *adapter)
77+
{
78+
struct ast_ddc *ddc = i2c_get_adapdata(adapter);
79+
struct ast_device *ast = ddc->ast;
80+
81+
mutex_unlock(&ast->modeset_lock);
82+
}
83+
84+
static int ast_ddc_algo_bit_data_getsda(void *data)
85+
{
86+
struct ast_ddc *ddc = data;
87+
struct ast_device *ast = ddc->ast;
6588
uint32_t val, val2, count, pass;
6689

6790
count = 0;
@@ -80,10 +103,10 @@ static int ast_i2c_getsda(void *i2c_priv)
80103
return val & 1 ? 1 : 0;
81104
}
82105

83-
static int ast_i2c_getscl(void *i2c_priv)
106+
static int ast_ddc_algo_bit_data_getscl(void *data)
84107
{
85-
struct ast_i2c_chan *i2c = i2c_priv;
86-
struct ast_device *ast = to_ast_device(i2c->dev);
108+
struct ast_ddc *ddc = data;
109+
struct ast_device *ast = ddc->ast;
87110
uint32_t val, val2, count, pass;
88111

89112
count = 0;
@@ -102,50 +125,53 @@ static int ast_i2c_getscl(void *i2c_priv)
102125
return val & 1 ? 1 : 0;
103126
}
104127

105-
static void ast_i2c_release(struct drm_device *dev, void *res)
128+
static void ast_ddc_release(struct drm_device *dev, void *res)
106129
{
107-
struct ast_i2c_chan *i2c = res;
130+
struct ast_ddc *ddc = res;
108131

109-
i2c_del_adapter(&i2c->adapter);
110-
kfree(i2c);
132+
i2c_del_adapter(&ddc->adapter);
111133
}
112134

113-
struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev)
135+
struct ast_ddc *ast_ddc_create(struct ast_device *ast)
114136
{
115-
struct ast_i2c_chan *i2c;
137+
struct drm_device *dev = &ast->base;
138+
struct ast_ddc *ddc;
139+
struct i2c_adapter *adapter;
140+
struct i2c_algo_bit_data *bit;
116141
int ret;
117142

118-
i2c = kzalloc(sizeof(struct ast_i2c_chan), GFP_KERNEL);
119-
if (!i2c)
120-
return NULL;
121-
122-
i2c->adapter.owner = THIS_MODULE;
123-
i2c->adapter.dev.parent = dev->dev;
124-
i2c->dev = dev;
125-
i2c_set_adapdata(&i2c->adapter, i2c);
126-
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name),
127-
"AST i2c bit bus");
128-
i2c->adapter.algo_data = &i2c->bit;
129-
130-
i2c->bit.udelay = 20;
131-
i2c->bit.timeout = 2;
132-
i2c->bit.data = i2c;
133-
i2c->bit.setsda = ast_i2c_setsda;
134-
i2c->bit.setscl = ast_i2c_setscl;
135-
i2c->bit.getsda = ast_i2c_getsda;
136-
i2c->bit.getscl = ast_i2c_getscl;
137-
ret = i2c_bit_add_bus(&i2c->adapter);
143+
ddc = drmm_kzalloc(dev, sizeof(*ddc), GFP_KERNEL);
144+
if (!ddc)
145+
return ERR_PTR(-ENOMEM);
146+
ddc->ast = ast;
147+
148+
adapter = &ddc->adapter;
149+
adapter->owner = THIS_MODULE;
150+
adapter->dev.parent = dev->dev;
151+
i2c_set_adapdata(adapter, ddc);
152+
snprintf(adapter->name, sizeof(adapter->name), "AST DDC bus");
153+
154+
bit = &ddc->bit;
155+
bit->udelay = 20;
156+
bit->timeout = 2;
157+
bit->data = ddc;
158+
bit->setsda = ast_ddc_algo_bit_data_setsda;
159+
bit->setscl = ast_ddc_algo_bit_data_setscl;
160+
bit->getsda = ast_ddc_algo_bit_data_getsda;
161+
bit->getscl = ast_ddc_algo_bit_data_getscl;
162+
bit->pre_xfer = ast_ddc_algo_bit_data_pre_xfer;
163+
bit->post_xfer = ast_ddc_algo_bit_data_post_xfer;
164+
165+
adapter->algo_data = bit;
166+
ret = i2c_bit_add_bus(adapter);
138167
if (ret) {
139168
drm_err(dev, "Failed to register bit i2c\n");
140-
goto out_kfree;
169+
return ERR_PTR(ret);
141170
}
142171

143-
ret = drmm_add_action_or_reset(dev, ast_i2c_release, i2c);
172+
ret = drmm_add_action_or_reset(dev, ast_ddc_release, ddc);
144173
if (ret)
145-
return NULL;
146-
return i2c;
174+
return ERR_PTR(ret);
147175

148-
out_kfree:
149-
kfree(i2c);
150-
return NULL;
176+
return ddc;
151177
}

drivers/gpu/drm/ast/ast_ddc.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 ast_device;
10+
11+
struct ast_ddc {
12+
struct ast_device *ast;
13+
14+
struct i2c_adapter adapter;
15+
struct i2c_algo_bit_data bit;
16+
};
17+
18+
struct ast_ddc *ast_ddc_create(struct ast_device *ast);
19+
20+
#endif

drivers/gpu/drm/ast/ast_drv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828

2929
#include <linux/module.h>
30+
#include <linux/of.h>
3031
#include <linux/pci.h>
3132

3233
#include <drm/drm_aperture.h>

drivers/gpu/drm/ast/ast_drv.h

Lines changed: 3 additions & 36 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,37 +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-
161-
struct ast_vga_connector {
162-
struct drm_connector base;
163-
struct ast_i2c_chan *i2c;
164-
};
165-
166-
static inline struct ast_vga_connector *
167-
to_ast_vga_connector(struct drm_connector *connector)
168-
{
169-
return container_of(connector, struct ast_vga_connector, base);
170-
}
171-
172-
struct ast_sil164_connector {
173-
struct drm_connector base;
174-
struct ast_i2c_chan *i2c;
175-
};
176-
177-
static inline struct ast_sil164_connector *
178-
to_ast_sil164_connector(struct drm_connector *connector)
179-
{
180-
return container_of(connector, struct ast_sil164_connector, base);
181-
}
182-
183153
struct ast_bmc_connector {
184154
struct drm_connector base;
185155
struct drm_connector *physical_connector;
@@ -222,11 +192,11 @@ struct ast_device {
222192
struct {
223193
struct {
224194
struct drm_encoder encoder;
225-
struct ast_vga_connector vga_connector;
195+
struct drm_connector connector;
226196
} vga;
227197
struct {
228198
struct drm_encoder encoder;
229-
struct ast_sil164_connector sil164_connector;
199+
struct drm_connector connector;
230200
} sil164;
231201
struct {
232202
struct drm_encoder encoder;
@@ -498,9 +468,6 @@ bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata);
498468
u8 ast_get_dp501_max_clk(struct drm_device *dev);
499469
void ast_init_3rdtx(struct drm_device *dev);
500470

501-
/* ast_i2c.c */
502-
struct ast_i2c_chan *ast_i2c_create(struct drm_device *dev);
503-
504471
/* aspeed DP */
505472
bool ast_astdp_is_connected(struct ast_device *ast);
506473
int ast_astdp_read_edid(struct drm_device *dev, u8 *ediddata);

drivers/gpu/drm/ast/ast_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* Authors: Dave Airlie <[email protected]>
2727
*/
2828

29+
#include <linux/of.h>
2930
#include <linux/pci.h>
3031

3132
#include <drm/drm_atomic_helper.h>

0 commit comments

Comments
 (0)