Skip to content

Commit 3dfc35f

Browse files
andriitKevin Hilman
authored andcommitted
PM / AVS: SmartReflex: use omap_sr * for errgen interfaces
SmartReflex driver interface is natively divided to two parts: - external SmartReflex interface - interface between SmartReflex driver and SmartReflex Class Functions which belong to AVS class interface can use struct omap_sr* instead of struct voltatedomain*, to provide a direct connection between SR driver and SR class. This allows us to optimize and not do additional lookups where none is required. sr_disable_errgen() and sr_configure_errgen() are interface functions between SR driver and SR class. They are typically used by Class driver to configure error generator module during SmartReflex enable/disable sequence. Now they take struct omap_sr* as input parameter. Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org>
1 parent 33da282 commit 3dfc35f

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

‎arch/arm/mach-omap2/smartreflex-class3.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static int sr_class3_enable(struct omap_sr *sr)
3131

3232
static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
3333
{
34-
sr_disable_errgen(sr->voltdm);
34+
sr_disable_errgen(sr);
3535
omap_vp_disable(sr->voltdm);
3636
sr_disable(sr->voltdm);
3737
if (is_volt_reset)
@@ -42,7 +42,7 @@ static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
4242

4343
static int sr_class3_configure(struct omap_sr *sr)
4444
{
45-
return sr_configure_errgen(sr->voltdm);
45+
return sr_configure_errgen(sr);
4646
}
4747

4848
/* SR class3 structure */

‎drivers/power/avs/smartreflex.c‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ static struct omap_sr_nvalue_table *sr_retrieve_nvalue_row(
342342
/* Public Functions */
343343

344344
/**
345-
* sr_configure_errgen() - Configures the smrtreflex to perform AVS using the
345+
* sr_configure_errgen() - Configures the SmartReflex to perform AVS using the
346346
* error generator module.
347-
* @voltdm: VDD pointer to which the SR module to be configured belongs to.
347+
* @sr: SR module to be configured.
348348
*
349349
* This API is to be called from the smartreflex class driver to
350350
* configure the error generator module inside the smartreflex module.
@@ -353,17 +353,17 @@ static struct omap_sr_nvalue_table *sr_retrieve_nvalue_row(
353353
* SR CLASS 2 can choose between ERROR module and MINMAXAVG
354354
* module. Returns 0 on success and error value in case of failure.
355355
*/
356-
int sr_configure_errgen(struct voltagedomain *voltdm)
356+
int sr_configure_errgen(struct omap_sr *sr)
357357
{
358358
u32 sr_config, sr_errconfig, errconfig_offs;
359359
u32 vpboundint_en, vpboundint_st;
360360
u32 senp_en = 0, senn_en = 0;
361361
u8 senp_shift, senn_shift;
362-
struct omap_sr *sr = _sr_lookup(voltdm);
363362

364-
if (IS_ERR(sr)) {
365-
pr_warning("%s: omap_sr struct for voltdm not found\n", __func__);
366-
return PTR_ERR(sr);
363+
if (!sr) {
364+
pr_warn("%s: NULL omap_sr from %pF\n", __func__,
365+
(void *)_RET_IP_);
366+
return -EINVAL;
367367
}
368368

369369
if (!sr->clk_length)
@@ -415,22 +415,22 @@ int sr_configure_errgen(struct voltagedomain *voltdm)
415415

416416
/**
417417
* sr_disable_errgen() - Disables SmartReflex AVS module's errgen component
418-
* @voltdm: VDD pointer to which the SR module to be configured belongs to.
418+
* @sr: SR module to be configured.
419419
*
420420
* This API is to be called from the smartreflex class driver to
421421
* disable the error generator module inside the smartreflex module.
422422
*
423423
* Returns 0 on success and error value in case of failure.
424424
*/
425-
int sr_disable_errgen(struct voltagedomain *voltdm)
425+
int sr_disable_errgen(struct omap_sr *sr)
426426
{
427427
u32 errconfig_offs;
428428
u32 vpboundint_en, vpboundint_st;
429-
struct omap_sr *sr = _sr_lookup(voltdm);
430429

431-
if (IS_ERR(sr)) {
432-
pr_warning("%s: omap_sr struct for voltdm not found\n", __func__);
433-
return PTR_ERR(sr);
430+
if (!sr) {
431+
pr_warn("%s: NULL omap_sr from %pF\n", __func__,
432+
(void *)_RET_IP_);
433+
return -EINVAL;
434434
}
435435

436436
switch (sr->ip_type) {

‎include/linux/power/smartreflex.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
301301
/* Smartreflex driver hooks to be called from Smartreflex class driver */
302302
int sr_enable(struct voltagedomain *voltdm, unsigned long volt);
303303
void sr_disable(struct voltagedomain *voltdm);
304-
int sr_configure_errgen(struct voltagedomain *voltdm);
305-
int sr_disable_errgen(struct voltagedomain *voltdm);
304+
int sr_configure_errgen(struct omap_sr *sr);
305+
int sr_disable_errgen(struct omap_sr *sr);
306306
int sr_configure_minmax(struct voltagedomain *voltdm);
307307

308308
/* API to register the smartreflex class driver with the smartreflex driver */

0 commit comments

Comments
 (0)