Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM / AVS: SmartReflex: use omap_sr * for minmax 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_configure_minmax() is interface function between SR driver
and SR class. It is typically used by Class driver to
configure MINMAXAVG module inside SmartReflex module.
Now it takes 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>

authored by

Andrii Tseglytskyi and committed by
Kevin Hilman
6c805734 3dfc35ff

+8 -8
+7 -7
drivers/power/avs/smartreflex.c
··· 465 465 } 466 466 467 467 /** 468 - * sr_configure_minmax() - Configures the smrtreflex to perform AVS using the 468 + * sr_configure_minmax() - Configures the SmartReflex to perform AVS using the 469 469 * minmaxavg module. 470 - * @voltdm: VDD pointer to which the SR module to be configured belongs to. 470 + * @sr: SR module to be configured. 471 471 * 472 472 * This API is to be called from the smartreflex class driver to 473 473 * configure the minmaxavg module inside the smartreflex module. ··· 476 476 * SR CLASS 2 can choose between ERROR module and MINMAXAVG 477 477 * module. Returns 0 on success and error value in case of failure. 478 478 */ 479 - int sr_configure_minmax(struct voltagedomain *voltdm) 479 + int sr_configure_minmax(struct omap_sr *sr) 480 480 { 481 481 u32 sr_config, sr_avgwt; 482 482 u32 senp_en = 0, senn_en = 0; 483 483 u8 senp_shift, senn_shift; 484 - struct omap_sr *sr = _sr_lookup(voltdm); 485 484 486 - if (IS_ERR(sr)) { 487 - pr_warning("%s: omap_sr struct for voltdm not found\n", __func__); 488 - return PTR_ERR(sr); 485 + if (!sr) { 486 + pr_warn("%s: NULL omap_sr from %pF\n", __func__, 487 + (void *)_RET_IP_); 488 + return -EINVAL; 489 489 } 490 490 491 491 if (!sr->clk_length)
+1 -1
include/linux/power/smartreflex.h
··· 303 303 void sr_disable(struct voltagedomain *voltdm); 304 304 int sr_configure_errgen(struct omap_sr *sr); 305 305 int sr_disable_errgen(struct omap_sr *sr); 306 - int sr_configure_minmax(struct voltagedomain *voltdm); 306 + int sr_configure_minmax(struct omap_sr *sr); 307 307 308 308 /* API to register the smartreflex class driver with the smartreflex driver */ 309 309 int sr_register_class(struct omap_sr_class_data *class_data);