clocksource: timer-ti-dm: Make unexported functions static
As dmtimer no longer exports functions, make those previously exported static (this requires few functions to be moved around as their prototypes were deleted). Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
This commit is contained in:
parent
ac30751df9
commit
592ea6bd1f
@ -163,6 +163,92 @@ static int omap_dm_timer_of_set_source(struct omap_dm_timer *timer)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
char *parent_name = NULL;
|
||||||
|
struct clk *parent;
|
||||||
|
struct dmtimer_platform_data *pdata;
|
||||||
|
|
||||||
|
if (unlikely(!timer))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
pdata = timer->pdev->dev.platform_data;
|
||||||
|
|
||||||
|
if (source < 0 || source >= 3)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME: Used for OMAP1 devices only because they do not currently
|
||||||
|
* use the clock framework to set the parent clock. To be removed
|
||||||
|
* once OMAP1 migrated to using clock framework for dmtimers
|
||||||
|
*/
|
||||||
|
if (pdata && pdata->set_timer_src)
|
||||||
|
return pdata->set_timer_src(timer->pdev, source);
|
||||||
|
|
||||||
|
if (IS_ERR(timer->fclk))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
#if defined(CONFIG_COMMON_CLK)
|
||||||
|
/* Check if the clock has configurable parents */
|
||||||
|
if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2)
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (source) {
|
||||||
|
case OMAP_TIMER_SRC_SYS_CLK:
|
||||||
|
parent_name = "timer_sys_ck";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OMAP_TIMER_SRC_32_KHZ:
|
||||||
|
parent_name = "timer_32k_ck";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OMAP_TIMER_SRC_EXT_CLK:
|
||||||
|
parent_name = "timer_ext_ck";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
parent = clk_get(&timer->pdev->dev, parent_name);
|
||||||
|
if (IS_ERR(parent)) {
|
||||||
|
pr_err("%s: %s not found\n", __func__, parent_name);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = clk_set_parent(timer->fclk, parent);
|
||||||
|
if (ret < 0)
|
||||||
|
pr_err("%s: failed to set %s as parent\n", __func__,
|
||||||
|
parent_name);
|
||||||
|
|
||||||
|
clk_put(parent);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void omap_dm_timer_enable(struct omap_dm_timer *timer)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
|
pm_runtime_get_sync(&timer->pdev->dev);
|
||||||
|
|
||||||
|
if (!(timer->capability & OMAP_TIMER_ALWON)) {
|
||||||
|
if (timer->get_context_loss_count) {
|
||||||
|
c = timer->get_context_loss_count(&timer->pdev->dev);
|
||||||
|
if (c != timer->ctx_loss_count) {
|
||||||
|
omap_timer_restore_context(timer);
|
||||||
|
timer->ctx_loss_count = c;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
omap_timer_restore_context(timer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void omap_dm_timer_disable(struct omap_dm_timer *timer)
|
||||||
|
{
|
||||||
|
pm_runtime_put_sync(&timer->pdev->dev);
|
||||||
|
}
|
||||||
|
|
||||||
static int omap_dm_timer_prepare(struct omap_dm_timer *timer)
|
static int omap_dm_timer_prepare(struct omap_dm_timer *timer)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
@ -298,16 +384,16 @@ found:
|
|||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct omap_dm_timer *omap_dm_timer_request(void)
|
static struct omap_dm_timer *omap_dm_timer_request(void)
|
||||||
{
|
{
|
||||||
return _omap_dm_timer_request(REQUEST_ANY, NULL);
|
return _omap_dm_timer_request(REQUEST_ANY, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct omap_dm_timer *omap_dm_timer_request_specific(int id)
|
static struct omap_dm_timer *omap_dm_timer_request_specific(int id)
|
||||||
{
|
{
|
||||||
/* Requesting timer by ID is not supported when device tree is used */
|
/* Requesting timer by ID is not supported when device tree is used */
|
||||||
if (of_have_populated_dt()) {
|
if (of_have_populated_dt()) {
|
||||||
pr_warn("%s: Please use omap_dm_timer_request_by_cap/node()\n",
|
pr_warn("%s: Please use omap_dm_timer_request_by_node()\n",
|
||||||
__func__);
|
__func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -336,7 +422,7 @@ struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap)
|
|||||||
* Request a timer based upon a device node pointer. Returns pointer to
|
* Request a timer based upon a device node pointer. Returns pointer to
|
||||||
* timer handle on success and a NULL pointer on failure.
|
* timer handle on success and a NULL pointer on failure.
|
||||||
*/
|
*/
|
||||||
struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *np)
|
static struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *np)
|
||||||
{
|
{
|
||||||
if (!np)
|
if (!np)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -344,7 +430,7 @@ struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *np)
|
|||||||
return _omap_dm_timer_request(REQUEST_BY_NODE, np);
|
return _omap_dm_timer_request(REQUEST_BY_NODE, np);
|
||||||
}
|
}
|
||||||
|
|
||||||
int omap_dm_timer_free(struct omap_dm_timer *timer)
|
static int omap_dm_timer_free(struct omap_dm_timer *timer)
|
||||||
{
|
{
|
||||||
if (unlikely(!timer))
|
if (unlikely(!timer))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -356,30 +442,6 @@ int omap_dm_timer_free(struct omap_dm_timer *timer)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void omap_dm_timer_enable(struct omap_dm_timer *timer)
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
|
|
||||||
pm_runtime_get_sync(&timer->pdev->dev);
|
|
||||||
|
|
||||||
if (!(timer->capability & OMAP_TIMER_ALWON)) {
|
|
||||||
if (timer->get_context_loss_count) {
|
|
||||||
c = timer->get_context_loss_count(&timer->pdev->dev);
|
|
||||||
if (c != timer->ctx_loss_count) {
|
|
||||||
omap_timer_restore_context(timer);
|
|
||||||
timer->ctx_loss_count = c;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
omap_timer_restore_context(timer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void omap_dm_timer_disable(struct omap_dm_timer *timer)
|
|
||||||
{
|
|
||||||
pm_runtime_put_sync(&timer->pdev->dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
|
int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
|
||||||
{
|
{
|
||||||
if (timer)
|
if (timer)
|
||||||
@ -389,6 +451,12 @@ int omap_dm_timer_get_irq(struct omap_dm_timer *timer)
|
|||||||
|
|
||||||
#if defined(CONFIG_ARCH_OMAP1)
|
#if defined(CONFIG_ARCH_OMAP1)
|
||||||
#include <mach/hardware.h>
|
#include <mach/hardware.h>
|
||||||
|
|
||||||
|
static struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* omap_dm_timer_modify_idlect_mask - Check if any running timers use ARMXOR
|
* omap_dm_timer_modify_idlect_mask - Check if any running timers use ARMXOR
|
||||||
* @inputmask: current value of idlect mask
|
* @inputmask: current value of idlect mask
|
||||||
@ -424,7 +492,7 @@ __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
|
static struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
|
||||||
{
|
{
|
||||||
if (timer && !IS_ERR(timer->fclk))
|
if (timer && !IS_ERR(timer->fclk))
|
||||||
return timer->fclk;
|
return timer->fclk;
|
||||||
@ -451,7 +519,7 @@ int omap_dm_timer_trigger(struct omap_dm_timer *timer)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int omap_dm_timer_start(struct omap_dm_timer *timer)
|
static int omap_dm_timer_start(struct omap_dm_timer *timer)
|
||||||
{
|
{
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
@ -471,7 +539,7 @@ int omap_dm_timer_start(struct omap_dm_timer *timer)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int omap_dm_timer_stop(struct omap_dm_timer *timer)
|
static int omap_dm_timer_stop(struct omap_dm_timer *timer)
|
||||||
{
|
{
|
||||||
unsigned long rate = 0;
|
unsigned long rate = 0;
|
||||||
|
|
||||||
@ -494,70 +562,8 @@ int omap_dm_timer_stop(struct omap_dm_timer *timer)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
|
static int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
|
||||||
{
|
unsigned int load)
|
||||||
int ret;
|
|
||||||
char *parent_name = NULL;
|
|
||||||
struct clk *parent;
|
|
||||||
struct dmtimer_platform_data *pdata;
|
|
||||||
|
|
||||||
if (unlikely(!timer))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
pdata = timer->pdev->dev.platform_data;
|
|
||||||
|
|
||||||
if (source < 0 || source >= 3)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME: Used for OMAP1 devices only because they do not currently
|
|
||||||
* use the clock framework to set the parent clock. To be removed
|
|
||||||
* once OMAP1 migrated to using clock framework for dmtimers
|
|
||||||
*/
|
|
||||||
if (pdata && pdata->set_timer_src)
|
|
||||||
return pdata->set_timer_src(timer->pdev, source);
|
|
||||||
|
|
||||||
if (IS_ERR(timer->fclk))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
#if defined(CONFIG_COMMON_CLK)
|
|
||||||
/* Check if the clock has configurable parents */
|
|
||||||
if (clk_hw_get_num_parents(__clk_get_hw(timer->fclk)) < 2)
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (source) {
|
|
||||||
case OMAP_TIMER_SRC_SYS_CLK:
|
|
||||||
parent_name = "timer_sys_ck";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OMAP_TIMER_SRC_32_KHZ:
|
|
||||||
parent_name = "timer_32k_ck";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OMAP_TIMER_SRC_EXT_CLK:
|
|
||||||
parent_name = "timer_ext_ck";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent = clk_get(&timer->pdev->dev, parent_name);
|
|
||||||
if (IS_ERR(parent)) {
|
|
||||||
pr_err("%s: %s not found\n", __func__, parent_name);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = clk_set_parent(timer->fclk, parent);
|
|
||||||
if (ret < 0)
|
|
||||||
pr_err("%s: failed to set %s as parent\n", __func__,
|
|
||||||
parent_name);
|
|
||||||
|
|
||||||
clk_put(parent);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
|
|
||||||
unsigned int load)
|
|
||||||
{
|
{
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
@ -609,9 +615,8 @@ int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
|
|||||||
timer->context.tcrr = load;
|
timer->context.tcrr = load;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
|
||||||
int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
|
unsigned int match)
|
||||||
unsigned int match)
|
|
||||||
{
|
{
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
@ -634,8 +639,8 @@ int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
|
static int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
|
||||||
int toggle, int trigger)
|
int toggle, int trigger)
|
||||||
{
|
{
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
@ -659,7 +664,8 @@ int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
|
static int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer,
|
||||||
|
int prescaler)
|
||||||
{
|
{
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
@ -681,8 +687,8 @@ int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
|
static int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
|
||||||
unsigned int value)
|
unsigned int value)
|
||||||
{
|
{
|
||||||
if (unlikely(!timer))
|
if (unlikely(!timer))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -704,7 +710,7 @@ int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
|
|||||||
*
|
*
|
||||||
* Disables the specified timer interrupts for a timer.
|
* Disables the specified timer interrupts for a timer.
|
||||||
*/
|
*/
|
||||||
int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
|
static int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
|
||||||
{
|
{
|
||||||
u32 l = mask;
|
u32 l = mask;
|
||||||
|
|
||||||
@ -727,7 +733,7 @@ int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
|
static unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
|
||||||
{
|
{
|
||||||
unsigned int l;
|
unsigned int l;
|
||||||
|
|
||||||
@ -741,7 +747,7 @@ unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
|
static int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
|
||||||
{
|
{
|
||||||
if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev)))
|
if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -751,7 +757,7 @@ int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
|
static unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
|
||||||
{
|
{
|
||||||
if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
|
if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
|
||||||
pr_err("%s: timer not iavailable or enabled.\n", __func__);
|
pr_err("%s: timer not iavailable or enabled.\n", __func__);
|
||||||
@ -761,7 +767,7 @@ unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
|
|||||||
return __omap_dm_timer_read_counter(timer, timer->posted);
|
return __omap_dm_timer_read_counter(timer, timer->posted);
|
||||||
}
|
}
|
||||||
|
|
||||||
int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
|
static int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value)
|
||||||
{
|
{
|
||||||
if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
|
if (unlikely(!timer || pm_runtime_suspended(&timer->pdev->dev))) {
|
||||||
pr_err("%s: timer not available or enabled.\n", __func__);
|
pr_err("%s: timer not available or enabled.\n", __func__);
|
||||||
|
@ -119,46 +119,13 @@ struct omap_dm_timer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int omap_dm_timer_reserve_systimer(int id);
|
int omap_dm_timer_reserve_systimer(int id);
|
||||||
struct omap_dm_timer *omap_dm_timer_request(void);
|
|
||||||
struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
|
|
||||||
struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap);
|
struct omap_dm_timer *omap_dm_timer_request_by_cap(u32 cap);
|
||||||
struct omap_dm_timer *omap_dm_timer_request_by_node(struct device_node *np);
|
|
||||||
int omap_dm_timer_free(struct omap_dm_timer *timer);
|
|
||||||
void omap_dm_timer_enable(struct omap_dm_timer *timer);
|
|
||||||
void omap_dm_timer_disable(struct omap_dm_timer *timer);
|
|
||||||
|
|
||||||
int omap_dm_timer_get_irq(struct omap_dm_timer *timer);
|
int omap_dm_timer_get_irq(struct omap_dm_timer *timer);
|
||||||
|
|
||||||
u32 omap_dm_timer_modify_idlect_mask(u32 inputmask);
|
u32 omap_dm_timer_modify_idlect_mask(u32 inputmask);
|
||||||
|
|
||||||
#ifndef CONFIG_ARCH_OMAP1
|
|
||||||
struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer);
|
|
||||||
#else
|
|
||||||
static inline
|
|
||||||
struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int omap_dm_timer_trigger(struct omap_dm_timer *timer);
|
int omap_dm_timer_trigger(struct omap_dm_timer *timer);
|
||||||
int omap_dm_timer_start(struct omap_dm_timer *timer);
|
|
||||||
int omap_dm_timer_stop(struct omap_dm_timer *timer);
|
|
||||||
|
|
||||||
int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source);
|
|
||||||
int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value);
|
|
||||||
int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value);
|
|
||||||
int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match);
|
|
||||||
int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger);
|
|
||||||
int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler);
|
|
||||||
|
|
||||||
int omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value);
|
|
||||||
int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask);
|
|
||||||
|
|
||||||
unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer);
|
|
||||||
int omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value);
|
|
||||||
unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer);
|
|
||||||
int omap_dm_timer_write_counter(struct omap_dm_timer *timer, unsigned int value);
|
|
||||||
|
|
||||||
int omap_dm_timers_active(void);
|
int omap_dm_timers_active(void);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user