Skip to content

Commit a094122

Browse files
petlozupthierryreding
authored andcommitted
soc/tegra: pmc: Support software wake-up for SPE
The Sensor Processing Engine(SPE) can trigger a software wake-up of the device. To support this wake-up for the SPE, set SR_CAPTURE_EN bit in WAKE_AOWAKE_CNTRL register associated with the wake-up for the SPE. This SR capturing logic is expected to be enabled for wakes with short pulse signalling requirements. Signed-off-by: Viswanath L <viswanathl@nvidia.com> Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent cc026cc commit a094122

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

drivers/soc/tegra/pmc.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
/* Tegra186 and later */
178178
#define WAKE_AOWAKE_CNTRL(x) (0x000 + ((x) << 2))
179179
#define WAKE_AOWAKE_CNTRL_LEVEL (1 << 3)
180+
#define WAKE_AOWAKE_CNTRL_SR_CAPTURE_EN (1 << 1)
180181
#define WAKE_AOWAKE_MASK_W(x) (0x180 + ((x) << 2))
181182
#define WAKE_AOWAKE_MASK_R(x) (0x300 + ((x) << 2))
182183
#define WAKE_AOWAKE_STATUS_W(x) (0x30c + ((x) << 2))
@@ -191,6 +192,8 @@
191192
#define WAKE_AOWAKE_CTRL 0x4f4
192193
#define WAKE_AOWAKE_CTRL_INTR_POLARITY BIT(0)
193194

195+
#define SW_WAKE_ID 83 /* wake83 */
196+
194197
/* for secure PMC */
195198
#define TEGRA_SMC_PMC 0xc2fffe00
196199
#define TEGRA_SMC_PMC_READ 0xaa
@@ -355,6 +358,7 @@ struct tegra_pmc_soc {
355358
void (*setup_irq_polarity)(struct tegra_pmc *pmc,
356359
struct device_node *np,
357360
bool invert);
361+
void (*set_wake_filters)(struct tegra_pmc *pmc);
358362
int (*irq_set_wake)(struct irq_data *data, unsigned int on);
359363
int (*irq_set_type)(struct irq_data *data, unsigned int type);
360364
int (*powergate_set)(struct tegra_pmc *pmc, unsigned int id,
@@ -2416,6 +2420,17 @@ static int tegra210_pmc_irq_set_type(struct irq_data *data, unsigned int type)
24162420
return 0;
24172421
}
24182422

2423+
static void tegra186_pmc_set_wake_filters(struct tegra_pmc *pmc)
2424+
{
2425+
u32 value;
2426+
2427+
/* SW Wake (wake83) needs SR_CAPTURE filter to be enabled */
2428+
value = readl(pmc->wake + WAKE_AOWAKE_CNTRL(SW_WAKE_ID));
2429+
value |= WAKE_AOWAKE_CNTRL_SR_CAPTURE_EN;
2430+
writel(value, pmc->wake + WAKE_AOWAKE_CNTRL(SW_WAKE_ID));
2431+
dev_dbg(pmc->dev, "WAKE_AOWAKE_CNTRL_83 = 0x%x\n", value);
2432+
}
2433+
24192434
static int tegra186_pmc_irq_set_wake(struct irq_data *data, unsigned int on)
24202435
{
24212436
struct tegra_pmc *pmc = irq_data_get_irq_chip_data(data);
@@ -3042,6 +3057,10 @@ static int tegra_pmc_probe(struct platform_device *pdev)
30423057
platform_set_drvdata(pdev, pmc);
30433058
tegra_pm_init_suspend();
30443059

3060+
/* Some wakes require specific filter configuration */
3061+
if (pmc->soc->set_wake_filters)
3062+
pmc->soc->set_wake_filters(pmc);
3063+
30453064
return 0;
30463065

30473066
cleanup_powergates:
@@ -3938,6 +3957,7 @@ static const struct tegra_pmc_soc tegra186_pmc_soc = {
39383957
.regs = &tegra186_pmc_regs,
39393958
.init = tegra186_pmc_init,
39403959
.setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
3960+
.set_wake_filters = tegra186_pmc_set_wake_filters,
39413961
.irq_set_wake = tegra186_pmc_irq_set_wake,
39423962
.irq_set_type = tegra186_pmc_irq_set_type,
39433963
.reset_sources = tegra186_reset_sources,
@@ -4122,6 +4142,7 @@ static const struct tegra_pmc_soc tegra194_pmc_soc = {
41224142
.regs = &tegra194_pmc_regs,
41234143
.init = tegra186_pmc_init,
41244144
.setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
4145+
.set_wake_filters = tegra186_pmc_set_wake_filters,
41254146
.irq_set_wake = tegra186_pmc_irq_set_wake,
41264147
.irq_set_type = tegra186_pmc_irq_set_type,
41274148
.reset_sources = tegra194_reset_sources,
@@ -4249,6 +4270,7 @@ static const struct tegra_pmc_soc tegra234_pmc_soc = {
42494270
.regs = &tegra234_pmc_regs,
42504271
.init = tegra186_pmc_init,
42514272
.setup_irq_polarity = tegra186_pmc_setup_irq_polarity,
4273+
.set_wake_filters = tegra186_pmc_set_wake_filters,
42524274
.irq_set_wake = tegra186_pmc_irq_set_wake,
42534275
.irq_set_type = tegra186_pmc_irq_set_type,
42544276
.reset_sources = tegra234_reset_sources,

0 commit comments

Comments
 (0)