Commit 6c9c1d66 authored by Radhesh Fadnis's avatar Radhesh Fadnis Committed by Greg Kroah-Hartman

staging: omap-thermal: introduce clock feature flag

The clock to Bandgap module is SW controlled on some version of
OMAP silicon (OMAP44xx). But on OMAP54xx ES2.0
onwards this is HW-Auto controlled. Hence introduce a feature flag
to use/not-to-use SW enable/disable of BG clock.
Signed-off-by: default avatarRadhesh Fadnis <radhesh.fadnis@ti.com>
Signed-off-by: default avatarEduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b3bf0e90
...@@ -914,7 +914,9 @@ int omap_bandgap_probe(struct platform_device *pdev) ...@@ -914,7 +914,9 @@ int omap_bandgap_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Cannot re-set clock rate. Continuing\n"); dev_err(&pdev->dev, "Cannot re-set clock rate. Continuing\n");
bg_ptr->clk_rate = clk_rate; bg_ptr->clk_rate = clk_rate;
clk_enable(bg_ptr->fclock); if (OMAP_BANDGAP_HAS(bg_ptr, CLK_CTRL))
clk_enable(bg_ptr->fclock);
mutex_init(&bg_ptr->bg_mutex); mutex_init(&bg_ptr->bg_mutex);
bg_ptr->dev = &pdev->dev; bg_ptr->dev = &pdev->dev;
...@@ -982,7 +984,8 @@ int omap_bandgap_probe(struct platform_device *pdev) ...@@ -982,7 +984,8 @@ int omap_bandgap_probe(struct platform_device *pdev)
return 0; return 0;
disable_clk: disable_clk:
clk_disable(bg_ptr->fclock); if (OMAP_BANDGAP_HAS(bg_ptr, CLK_CTRL))
clk_disable(bg_ptr->fclock);
put_clks: put_clks:
clk_put(bg_ptr->fclock); clk_put(bg_ptr->fclock);
clk_put(bg_ptr->div_clk); clk_put(bg_ptr->div_clk);
...@@ -1012,7 +1015,8 @@ int omap_bandgap_remove(struct platform_device *pdev) ...@@ -1012,7 +1015,8 @@ int omap_bandgap_remove(struct platform_device *pdev)
omap_bandgap_power(bg_ptr, false); omap_bandgap_power(bg_ptr, false);
clk_disable(bg_ptr->fclock); if (OMAP_BANDGAP_HAS(bg_ptr, CLK_CTRL))
clk_disable(bg_ptr->fclock);
clk_put(bg_ptr->fclock); clk_put(bg_ptr->fclock);
clk_put(bg_ptr->div_clk); clk_put(bg_ptr->div_clk);
...@@ -1109,7 +1113,9 @@ static int omap_bandgap_suspend(struct device *dev) ...@@ -1109,7 +1113,9 @@ static int omap_bandgap_suspend(struct device *dev)
err = omap_bandgap_save_ctxt(bg_ptr); err = omap_bandgap_save_ctxt(bg_ptr);
omap_bandgap_power(bg_ptr, false); omap_bandgap_power(bg_ptr, false);
clk_disable(bg_ptr->fclock);
if (OMAP_BANDGAP_HAS(bg_ptr, CLK_CTRL))
clk_disable(bg_ptr->fclock);
return err; return err;
} }
...@@ -1118,7 +1124,9 @@ static int omap_bandgap_resume(struct device *dev) ...@@ -1118,7 +1124,9 @@ static int omap_bandgap_resume(struct device *dev)
{ {
struct omap_bandgap *bg_ptr = dev_get_drvdata(dev); struct omap_bandgap *bg_ptr = dev_get_drvdata(dev);
clk_enable(bg_ptr->fclock); if (OMAP_BANDGAP_HAS(bg_ptr, CLK_CTRL))
clk_enable(bg_ptr->fclock);
omap_bandgap_power(bg_ptr, true); omap_bandgap_power(bg_ptr, true);
return omap_bandgap_restore_ctxt(bg_ptr); return omap_bandgap_restore_ctxt(bg_ptr);
......
...@@ -384,6 +384,7 @@ struct omap_bandgap_data { ...@@ -384,6 +384,7 @@ struct omap_bandgap_data {
#define OMAP_BANDGAP_FEATURE_MODE_CONFIG (1 << 3) #define OMAP_BANDGAP_FEATURE_MODE_CONFIG (1 << 3)
#define OMAP_BANDGAP_FEATURE_COUNTER (1 << 4) #define OMAP_BANDGAP_FEATURE_COUNTER (1 << 4)
#define OMAP_BANDGAP_FEATURE_POWER_SWITCH (1 << 5) #define OMAP_BANDGAP_FEATURE_POWER_SWITCH (1 << 5)
#define OMAP_BANDGAP_FEATURE_CLK_CTRL (1 << 6)
#define OMAP_BANDGAP_HAS(b, f) \ #define OMAP_BANDGAP_HAS(b, f) \
((b)->conf->features & OMAP_BANDGAP_FEATURE_ ## f) ((b)->conf->features & OMAP_BANDGAP_FEATURE_ ## f)
unsigned int features; unsigned int features;
......
...@@ -69,6 +69,7 @@ omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = { ...@@ -69,6 +69,7 @@ omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = {
/* OMAP4430 data */ /* OMAP4430 data */
const struct omap_bandgap_data omap4430_data = { const struct omap_bandgap_data omap4430_data = {
.features = OMAP_BANDGAP_FEATURE_MODE_CONFIG | .features = OMAP_BANDGAP_FEATURE_MODE_CONFIG |
OMAP_BANDGAP_FEATURE_CLK_CTRL |
OMAP_BANDGAP_FEATURE_POWER_SWITCH, OMAP_BANDGAP_FEATURE_POWER_SWITCH,
.fclock_name = "bandgap_fclk", .fclock_name = "bandgap_fclk",
.div_ck_name = "bandgap_fclk", .div_ck_name = "bandgap_fclk",
...@@ -207,6 +208,7 @@ const struct omap_bandgap_data omap4460_data = { ...@@ -207,6 +208,7 @@ const struct omap_bandgap_data omap4460_data = {
OMAP_BANDGAP_FEATURE_TALERT | OMAP_BANDGAP_FEATURE_TALERT |
OMAP_BANDGAP_FEATURE_MODE_CONFIG | OMAP_BANDGAP_FEATURE_MODE_CONFIG |
OMAP_BANDGAP_FEATURE_POWER_SWITCH | OMAP_BANDGAP_FEATURE_POWER_SWITCH |
OMAP_BANDGAP_FEATURE_CLK_CTRL |
OMAP_BANDGAP_FEATURE_COUNTER, OMAP_BANDGAP_FEATURE_COUNTER,
.fclock_name = "bandgap_ts_fclk", .fclock_name = "bandgap_ts_fclk",
.div_ck_name = "div_ts_ck", .div_ck_name = "div_ts_ck",
...@@ -236,6 +238,7 @@ const struct omap_bandgap_data omap4470_data = { ...@@ -236,6 +238,7 @@ const struct omap_bandgap_data omap4470_data = {
OMAP_BANDGAP_FEATURE_TALERT | OMAP_BANDGAP_FEATURE_TALERT |
OMAP_BANDGAP_FEATURE_MODE_CONFIG | OMAP_BANDGAP_FEATURE_MODE_CONFIG |
OMAP_BANDGAP_FEATURE_POWER_SWITCH | OMAP_BANDGAP_FEATURE_POWER_SWITCH |
OMAP_BANDGAP_FEATURE_CLK_CTRL |
OMAP_BANDGAP_FEATURE_COUNTER, OMAP_BANDGAP_FEATURE_COUNTER,
.fclock_name = "bandgap_ts_fclk", .fclock_name = "bandgap_ts_fclk",
.div_ck_name = "div_ts_ck", .div_ck_name = "div_ts_ck",
......
...@@ -260,7 +260,8 @@ const struct omap_bandgap_data omap5430_data = { ...@@ -260,7 +260,8 @@ const struct omap_bandgap_data omap5430_data = {
.features = OMAP_BANDGAP_FEATURE_TSHUT_CONFIG | .features = OMAP_BANDGAP_FEATURE_TSHUT_CONFIG |
OMAP_BANDGAP_FEATURE_TALERT | OMAP_BANDGAP_FEATURE_TALERT |
OMAP_BANDGAP_FEATURE_MODE_CONFIG | OMAP_BANDGAP_FEATURE_MODE_CONFIG |
OMAP_BANDGAP_FEATURE_COUNTER, OMAP_BANDGAP_FEATURE_COUNTER |
OMAP_BANDGAP_FEATURE_CLK_CTRL,
.fclock_name = "ts_clk_div_ck", .fclock_name = "ts_clk_div_ck",
.div_ck_name = "ts_clk_div_ck", .div_ck_name = "ts_clk_div_ck",
.conv_table = omap5430_adc_to_temp, .conv_table = omap5430_adc_to_temp,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment