Skip to content

Commit 0638226

Browse files
fltobebarino
authored andcommitted
clk: qcom: add common gdsc_gx_do_nothing_enable for gpucc drivers
All gpucc drivers need this, so move it to common code instead of duplicating it in every gpucc driver. Signed-off-by: Jonathan Marek <[email protected]> Tested-by: Dmitry Baryshkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 324e0bf commit 0638226

File tree

4 files changed

+28
-52
lines changed

4 files changed

+28
-52
lines changed

drivers/clk/qcom/gdsc.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,28 @@ void gdsc_unregister(struct gdsc_desc *desc)
433433
}
434434
of_genpd_del_provider(dev->of_node);
435435
}
436+
437+
/*
438+
* On SDM845+ the GPU GX domain is *almost* entirely controlled by the GMU
439+
* running in the CX domain so the CPU doesn't need to know anything about the
440+
* GX domain EXCEPT....
441+
*
442+
* Hardware constraints dictate that the GX be powered down before the CX. If
443+
* the GMU crashes it could leave the GX on. In order to successfully bring back
444+
* the device the CPU needs to disable the GX headswitch. There being no sane
445+
* way to reach in and touch that register from deep inside the GPU driver we
446+
* need to set up the infrastructure to be able to ensure that the GPU can
447+
* ensure that the GX is off during this super special case. We do this by
448+
* defining a GX gdsc with a dummy enable function and a "default" disable
449+
* function.
450+
*
451+
* This allows us to attach with genpd_dev_pm_attach_by_name() in the GPU
452+
* driver. During power up, nothing will happen from the CPU (and the GMU will
453+
* power up normally but during power down this will ensure that the GX domain
454+
* is *really* off - this gives us a semi standard way of doing what we need.
455+
*/
456+
int gdsc_gx_do_nothing_enable(struct generic_pm_domain *domain)
457+
{
458+
/* Do nothing but give genpd the impression that we were successful */
459+
return 0;
460+
}

drivers/clk/qcom/gdsc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct gdsc_desc {
6868
int gdsc_register(struct gdsc_desc *desc, struct reset_controller_dev *,
6969
struct regmap *);
7070
void gdsc_unregister(struct gdsc_desc *desc);
71+
int gdsc_gx_do_nothing_enable(struct generic_pm_domain *domain);
7172
#else
7273
static inline int gdsc_register(struct gdsc_desc *desc,
7374
struct reset_controller_dev *rcdev,

drivers/clk/qcom/gpucc-sc7180.c

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -170,37 +170,12 @@ static struct gdsc cx_gdsc = {
170170
.flags = VOTABLE,
171171
};
172172

173-
/*
174-
* On SC7180 the GPU GX domain is *almost* entirely controlled by the GMU
175-
* running in the CX domain so the CPU doesn't need to know anything about the
176-
* GX domain EXCEPT....
177-
*
178-
* Hardware constraints dictate that the GX be powered down before the CX. If
179-
* the GMU crashes it could leave the GX on. In order to successfully bring back
180-
* the device the CPU needs to disable the GX headswitch. There being no sane
181-
* way to reach in and touch that register from deep inside the GPU driver we
182-
* need to set up the infrastructure to be able to ensure that the GPU can
183-
* ensure that the GX is off during this super special case. We do this by
184-
* defining a GX gdsc with a dummy enable function and a "default" disable
185-
* function.
186-
*
187-
* This allows us to attach with genpd_dev_pm_attach_by_name() in the GPU
188-
* driver. During power up, nothing will happen from the CPU (and the GMU will
189-
* power up normally but during power down this will ensure that the GX domain
190-
* is *really* off - this gives us a semi standard way of doing what we need.
191-
*/
192-
static int gx_gdsc_enable(struct generic_pm_domain *domain)
193-
{
194-
/* Do nothing but give genpd the impression that we were successful */
195-
return 0;
196-
}
197-
198173
static struct gdsc gx_gdsc = {
199174
.gdscr = 0x100c,
200175
.clamp_io_ctrl = 0x1508,
201176
.pd = {
202177
.name = "gx_gdsc",
203-
.power_on = gx_gdsc_enable,
178+
.power_on = gdsc_gx_do_nothing_enable,
204179
},
205180
.pwrsts = PWRSTS_OFF_ON,
206181
.flags = CLAMP_IO,

drivers/clk/qcom/gpucc-sdm845.c

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -131,37 +131,12 @@ static struct gdsc gpu_cx_gdsc = {
131131
.flags = VOTABLE,
132132
};
133133

134-
/*
135-
* On SDM845 the GPU GX domain is *almost* entirely controlled by the GMU
136-
* running in the CX domain so the CPU doesn't need to know anything about the
137-
* GX domain EXCEPT....
138-
*
139-
* Hardware constraints dictate that the GX be powered down before the CX. If
140-
* the GMU crashes it could leave the GX on. In order to successfully bring back
141-
* the device the CPU needs to disable the GX headswitch. There being no sane
142-
* way to reach in and touch that register from deep inside the GPU driver we
143-
* need to set up the infrastructure to be able to ensure that the GPU can
144-
* ensure that the GX is off during this super special case. We do this by
145-
* defining a GX gdsc with a dummy enable function and a "default" disable
146-
* function.
147-
*
148-
* This allows us to attach with genpd_dev_pm_attach_by_name() in the GPU
149-
* driver. During power up, nothing will happen from the CPU (and the GMU will
150-
* power up normally but during power down this will ensure that the GX domain
151-
* is *really* off - this gives us a semi standard way of doing what we need.
152-
*/
153-
static int gx_gdsc_enable(struct generic_pm_domain *domain)
154-
{
155-
/* Do nothing but give genpd the impression that we were successful */
156-
return 0;
157-
}
158-
159134
static struct gdsc gpu_gx_gdsc = {
160135
.gdscr = 0x100c,
161136
.clamp_io_ctrl = 0x1508,
162137
.pd = {
163138
.name = "gpu_gx_gdsc",
164-
.power_on = gx_gdsc_enable,
139+
.power_on = gdsc_gx_do_nothing_enable,
165140
},
166141
.pwrsts = PWRSTS_OFF_ON,
167142
.flags = CLAMP_IO | AON_RESET | POLL_CFG_GDSCR,

0 commit comments

Comments
 (0)