Skip to content
Merged
56 changes: 1 addition & 55 deletions drivers/iommu/apple-dart.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,8 @@ struct apple_dart {
bool sleep_flushed;
/* The firmware 27 display sleep owns it: never replay locked trees. */
struct device *m5_sleep_owner;
u32 m5_streams, m5_gapf, m5_diag, m5_error_mask, m5_protect, m5_lock;
u32 m5_disp_streams; /* the display pipe's streams before its domain went off */
bool m5_released, m5_changed, m5_display, m5_failed;
bool m5_display;
/* Optional cached evidence; never a sleep-ownership grant. */
/*
* Held for as long as a sleep lease lasts: taken by the suspend that claims the lease and
Expand Down Expand Up @@ -9296,59 +9295,6 @@ static int apple_dart_m5_idle(struct apple_dart *dart)
}


int apple_dart_m5_restore(struct device *dev, struct device *owner)
{
struct apple_dart *dart = dev_get_drvdata(dev);
u32 status;
int ret;

if (!dart)
return -EINVAL;
guard(spinlock_irqsave)(&dart->lock);
if (dart->m5_sleep_owner != owner)
return -EINVAL;
if (dart->m5_failed)
return -EUCLEAN;
if (!dart->m5_changed)
goto done;
/* Caller proved power up. This is a retained warm path, never a cold
* mapper rebuild, PROTECT unlock, or firmware memory reallocation.
*/
if (!apple_dart_state_retained(dart) ||
readl(dart->regs + DART_T8110_PROTECT) != dart->m5_protect ||
readl(dart->regs + DART_T8110_PROTECT_LOCK) != dart->m5_lock) {
dart->m5_failed = true;
return -EUCLEAN;
}
/* A partial restore is uncertain too; only full readback clears poison. */
dart->m5_failed = true;
writel(dart->m5_gapf, dart->gapf);
if (readl(dart->gapf) != dart->m5_gapf)
return -EIO;
writel(DART_T8110_TLB_CMD_POWERDOWN, dart->regs + DART_T8110_TLB_CMD);
ret = readl_poll_timeout_atomic(dart->regs + DART_T8110_TLB_CMD, status,
!(status & DART_T8110_TLB_CMD_BUSY), 1, DART_T8110_FLUSH_BUSY_TIMEOUT);
if (ret)
return ret;
if (dart->ctc_flush)
writel(0, dart->regs + DART_T8110_CTC_FLUSH);
writel(dart->m5_diag, dart->regs + DART_T8110_DIAG_LOCK);
writel(dart->m5_error_mask, dart->regs + DART_T8110_V2_ERROR_MASK);
writel(dart->m5_streams, dart->regs + DART_T8110_ENABLE_STREAMS);
if (apple_dart_m5_streams_unowned(dart, dart->m5_streams) ||
readl(dart->regs + DART_T8110_ENABLE_STREAMS) != dart->m5_streams)
return -EIO;
WRITE_ONCE(dart->display_tlb_stale, false);
WRITE_ONCE(dart->display_dark, false);
done:
dart->m5_failed = false;
dart->m5_changed = false;
dart->m5_released = false;
dart->m5_sleep_owner = NULL;
return 0;
}
EXPORT_SYMBOL_GPL(apple_dart_m5_restore);

/*
* T6050 (firmware 27): a display coprocessor's DART around a stop and restart of that
* coprocessor after a wake, outside a system sleep, and the internal display pipe's DART
Expand Down
11 changes: 0 additions & 11 deletions drivers/media/platform/apple/isp/isp-fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ static void isp_firmware_shutdown_stage1(struct apple_isp *isp)
static int isp_firmware_boot_stage1(struct apple_isp *isp)
{
int err;
// u32 val;

isp_restore_fw_memory(isp);

Expand All @@ -562,16 +561,6 @@ static int isp_firmware_boot_stage1(struct apple_isp *isp)
if (isp->hw->gen != ISP_GEN_T8140 && isp->hw->gen != ISP_GEN_T6040)
isp_gpio_write32(isp, ISP_GPIO_CLOCK_EN, 0x1);

#if 0
/* This doesn't work well with system sleep */
val = isp_gpio_read32(isp, ISP_GPIO_1);
if (val == 0xfeedbabe) {
err = isp_reset_coproc(isp);
if (err < 0)
return err;
}
#endif

err = isp_reset_coproc(isp);
if (err < 0)
goto shutdown;
Expand Down
6 changes: 0 additions & 6 deletions drivers/soc/apple/pmp-display.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,6 @@ int apple_pmp_j713_display_check_release(struct device *consumer)
}
EXPORT_SYMBOL_GPL(apple_pmp_j713_display_check_release);

int apple_pmp_j713_gpu_check(struct device *consumer)
{
return apple_pmp_j713_board() ? pmp_power_check(consumer, PMP_POWER_AGX, false) : -ENODEV;
}
EXPORT_SYMBOL_GPL(apple_pmp_j713_gpu_check);

int apple_pmp_j713_display_get(struct device *consumer)
{
return apple_pmp_j713_board() ? pmp_power_get(consumer, PMP_POWER_DISP) : -ENODEV;
Expand Down
6 changes: 0 additions & 6 deletions drivers/soc/apple/rtkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -3801,12 +3801,6 @@ struct apple_rtkit *devm_apple_rtkit_init_m5_saved(struct device *dev, void *coo
}
EXPORT_SYMBOL_GPL(devm_apple_rtkit_init_m5_saved);

void devm_apple_rtkit_free(struct device *dev, struct apple_rtkit *rtk)
{
devm_release_action(dev, apple_rtkit_free_wrapper, rtk);
}
EXPORT_SYMBOL_GPL(devm_apple_rtkit_free);

MODULE_LICENSE("Dual MIT/GPL");
MODULE_AUTHOR("Sven Peter <sven@svenpeter.dev>");
MODULE_DESCRIPTION("Apple RTKit driver");
Expand Down
18 changes: 0 additions & 18 deletions drivers/soc/apple/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1994,24 +1994,6 @@ bool apple_sleep_smc_gen1_keys(void)
}
EXPORT_SYMBOL_GPL(apple_sleep_smc_gen1_keys);

int apple_sleep_smc_register(struct device *dev,
int (*late_notice)(void *data, u64 *sent, u64 *ack), void *data)
{
struct apple_sleep *s = apple_sleep;
guard(mutex)(&apple_sleep_smc_lock);

if (!s || !s->soc->smc_policy || !pm_suspend_via_firmware())
return -EOPNOTSUPP;
if (!late_notice || s->smc.saved_ops || (s->smc.dev && s->smc.dev != dev))
return -EBUSY;
if (!s->smc.dev)
s->smc.dev = get_device(dev);
s->smc.late_notice = late_notice;
s->smc.data = data;
return 0;
}
EXPORT_SYMBOL_GPL(apple_sleep_smc_register);

int apple_sleep_smc_register_saved(struct device *dev,
const struct apple_sleep_smc_saved_ops *ops, void *data)
{
Expand Down
7 changes: 0 additions & 7 deletions include/linux/soc/apple/dart.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ int apple_dart_display_streams_idle(struct device *dev, u32 streams);
int apple_dart_gapf_ready(struct device *dev);
/* A display DART whose domain goes off at runtime while others still map into it. */
int apple_dart_power_dark(struct device *dev, bool dark);
/* A DART's state kept across its consumer's own power cycle, outside a system sleep. */
int apple_dart_m5_restore(struct device *dev, struct device *owner);
/* T6050: a display coprocessor's DART around its restart, the display pipe's around its domain's. */
int apple_dart_m5_display_cycle(struct device *dev, bool on);
int apple_dart_m5_display_snapshot(struct device *dev);
Expand Down Expand Up @@ -288,11 +286,6 @@ static inline int apple_dart_power_dark(struct device *dev, bool dark)
return 0;
}

static inline int apple_dart_m5_restore(struct device *dev, struct device *owner)
{
return -EOPNOTSUPP;
}

static inline int apple_dart_m5_display_cycle(struct device *dev, bool on) { return -EOPNOTSUPP; }
static inline int apple_dart_m5_display_snapshot(struct device *dev) { return -EOPNOTSUPP; }
static inline int apple_dart_m5_display_rewrite(struct device *dev) { return -EOPNOTSUPP; }
Expand Down
1 change: 0 additions & 1 deletion include/linux/soc/apple/pmp-display.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ int apple_pmp_j713_display_check(struct device *consumer);
int apple_pmp_j713_display_check_release(struct device *consumer);
int apple_pmp_j713_gpu_prepare(struct device *consumer);
int apple_pmp_j713_gpu_get(struct device *consumer);
int apple_pmp_j713_gpu_check(struct device *consumer);

#endif
8 changes: 0 additions & 8 deletions include/linux/soc/apple/rtkit.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ struct apple_rtkit;
struct apple_rtkit *devm_apple_rtkit_init(struct device *dev, void *cookie,
const char *mbox_name, int mbox_idx,
const struct apple_rtkit_ops *ops);
/*
* Frees internal RTKit state allocated by devm_apple_rtkit_init().
*
* @dev: Pointer to the device node this coprocessor is assocated with
* @rtk: Internal RTKit state initialized by devm_apple_rtkit_init()
*/
void devm_apple_rtkit_free(struct device *dev, struct apple_rtkit *rtk);

/*
* Non-devm version of devm_apple_rtkit_init. Must be freed with
* apple_rtkit_free.
Expand Down
4 changes: 0 additions & 4 deletions include/linux/soc/apple/sleep.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ const struct apple_sleep_smc_policy *apple_sleep_smc_policy(void);
bool apple_sleep_smc_defer_notice(void);
/* Gen 1 (T8103): the SMC gets WKTP between slpw and slpa */
bool apple_sleep_smc_gen1_keys(void);
int apple_sleep_smc_register(struct device *dev,
int (*late_notice)(void *data, u64 *sent, u64 *ack), void *data);
int apple_sleep_smc_register_saved(struct device *dev,
const struct apple_sleep_smc_saved_ops *ops, void *data);
void apple_sleep_smc_unregister(struct device *dev);
Expand Down Expand Up @@ -315,8 +313,6 @@ bool apple_sleep_wdt_active(struct device *dev);
static inline const struct apple_sleep_smc_policy *apple_sleep_smc_policy(void) { return NULL; }
static inline bool apple_sleep_smc_defer_notice(void) { return false; }
static inline bool apple_sleep_smc_gen1_keys(void) { return false; }
static inline int apple_sleep_smc_register(struct device *dev,
int (*late_notice)(void *data, u64 *sent, u64 *ack), void *data) { return -EOPNOTSUPP; }
static inline int apple_sleep_smc_register_saved(struct device *dev,
const struct apple_sleep_smc_saved_ops *ops, void *data) { return -EOPNOTSUPP; }
static inline void apple_sleep_smc_unregister(struct device *dev) {}
Expand Down
Loading