@@ -74,24 +74,29 @@ struct atpx_mux {
74
74
u16 mux ;
75
75
} __packed ;
76
76
77
- bool amdgpu_has_atpx (void ) {
77
+ bool amdgpu_has_atpx (void )
78
+ {
78
79
return amdgpu_atpx_priv .atpx_detected ;
79
80
}
80
81
81
- bool amdgpu_has_atpx_dgpu_power_cntl (void ) {
82
+ bool amdgpu_has_atpx_dgpu_power_cntl (void )
83
+ {
82
84
return amdgpu_atpx_priv .atpx .functions .power_cntl ;
83
85
}
84
86
85
- bool amdgpu_is_atpx_hybrid (void ) {
87
+ bool amdgpu_is_atpx_hybrid (void )
88
+ {
86
89
return amdgpu_atpx_priv .atpx .is_hybrid ;
87
90
}
88
91
89
- bool amdgpu_atpx_dgpu_req_power_for_displays (void ) {
92
+ bool amdgpu_atpx_dgpu_req_power_for_displays (void )
93
+ {
90
94
return amdgpu_atpx_priv .atpx .dgpu_req_power_for_displays ;
91
95
}
92
96
93
97
#if defined(CONFIG_ACPI )
94
- void * amdgpu_atpx_get_dhandle (void ) {
98
+ void * amdgpu_atpx_get_dhandle (void )
99
+ {
95
100
return amdgpu_atpx_priv .dhandle ;
96
101
}
97
102
#endif
@@ -113,6 +118,8 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function,
113
118
union acpi_object atpx_arg_elements [2 ];
114
119
struct acpi_object_list atpx_arg ;
115
120
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER , NULL };
121
+ struct acpi_device * adev = container_of (handle , struct acpi_device , handle );
122
+ struct device * dev = & adev -> dev ;
116
123
117
124
atpx_arg .count = 2 ;
118
125
atpx_arg .pointer = & atpx_arg_elements [0 ];
@@ -134,8 +141,8 @@ static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function,
134
141
135
142
/* Fail only if calling the method fails and ATPX is supported */
136
143
if (ACPI_FAILURE (status ) && status != AE_NOT_FOUND ) {
137
- printk ( "failed to evaluate ATPX got %s\n" ,
138
- acpi_format_exception (status ));
144
+ dev_err ( dev , "failed to evaluate ATPX got %s\n" ,
145
+ acpi_format_exception (status ));
139
146
kfree (buffer .pointer );
140
147
return NULL ;
141
148
}
@@ -176,6 +183,8 @@ static void amdgpu_atpx_parse_functions(struct amdgpu_atpx_functions *f, u32 mas
176
183
static int amdgpu_atpx_validate (struct amdgpu_atpx * atpx )
177
184
{
178
185
u32 valid_bits = 0 ;
186
+ struct acpi_device * adev = container_of (atpx -> handle , struct acpi_device , handle );
187
+ struct device * dev = & adev -> dev ;
179
188
180
189
if (atpx -> functions .px_params ) {
181
190
union acpi_object * info ;
@@ -190,7 +199,7 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
190
199
191
200
size = * (u16 * ) info -> buffer .pointer ;
192
201
if (size < 10 ) {
193
- printk ( "ATPX buffer is too small: %zu\n" , size );
202
+ dev_err ( dev , "ATPX buffer is too small: %zu\n" , size );
194
203
kfree (info );
195
204
return - EINVAL ;
196
205
}
@@ -223,11 +232,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
223
232
atpx -> is_hybrid = false;
224
233
if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED ) {
225
234
if (amdgpu_atpx_priv .quirks & AMDGPU_PX_QUIRK_FORCE_ATPX ) {
226
- printk ( "ATPX Hybrid Graphics, forcing to ATPX\n" );
235
+ dev_info ( dev , "ATPX Hybrid Graphics, forcing to ATPX\n" );
227
236
atpx -> functions .power_cntl = true;
228
237
atpx -> is_hybrid = false;
229
238
} else {
230
- printk ( "ATPX Hybrid Graphics\n" );
239
+ dev_info ( dev , "ATPX Hybrid Graphics\n" );
231
240
/*
232
241
* Disable legacy PM methods only when pcie port PM is usable,
233
242
* otherwise the device might fail to power off or power on.
@@ -260,6 +269,8 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx)
260
269
struct atpx_verify_interface output ;
261
270
size_t size ;
262
271
int err = 0 ;
272
+ struct acpi_device * adev = container_of (atpx -> handle , struct acpi_device , handle );
273
+ struct device * dev = & adev -> dev ;
263
274
264
275
info = amdgpu_atpx_call (atpx -> handle , ATPX_FUNCTION_VERIFY_INTERFACE , NULL );
265
276
if (!info )
@@ -278,8 +289,8 @@ static int amdgpu_atpx_verify_interface(struct amdgpu_atpx *atpx)
278
289
memcpy (& output , info -> buffer .pointer , size );
279
290
280
291
/* TODO: check version? */
281
- printk ( "ATPX version %u, functions 0x%08x\n" ,
282
- output .version , output .function_bits );
292
+ dev_info ( dev , "ATPX version %u, functions 0x%08x\n" ,
293
+ output .version , output .function_bits );
283
294
284
295
amdgpu_atpx_parse_functions (& atpx -> functions , output .function_bits );
285
296
0 commit comments