Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93bd1fd6 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ocmem: Add support for driver probe deferral"

parents 56f8e0ca b5b2d1e3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ int get_tz_id(int);
int ocmem_enable_sec_program(int);
int ocmem_enable_dump(enum ocmem_client, unsigned long, unsigned long);
int ocmem_disable_dump(enum ocmem_client, unsigned long, unsigned long);
bool is_probe_done(void);
int check_id(int);
int dispatch_notification(int, enum ocmem_notif_type, struct ocmem_buf *);

+23 −17
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ struct ocmem_zone *get_zone(unsigned id)

static struct ocmem_plat_data *ocmem_pdata;

static bool probe_done;

#define CLIENT_NAME_MAX 10

/* Must be in sync with enum ocmem_client */
@@ -118,6 +120,11 @@ static inline int get_id(const char *name)
	return -EINVAL;
}

bool is_probe_done(void)
{
	return probe_done;
}

int check_id(int id)
{
	return (id < OCMEM_CLIENT_MAX && id >= OCMEM_GRAPHICS);
@@ -789,23 +796,6 @@ static int msm_ocmem_probe(struct platform_device *pdev)
	struct clk *ocmem_core_clk = NULL;
	struct clk *ocmem_iface_clk = NULL;

	if (!pdev->dev.of_node) {
		dev_info(dev, "Missing Configuration in Device Tree\n");
		ocmem_pdata = parse_static_config(pdev);
	} else {
		ocmem_pdata = parse_dt_config(pdev);
	}

	/* Check if we have some configuration data to start */
	if (!ocmem_pdata)
		return -ENODEV;

	/* Sanity Checks */
	BUG_ON(!IS_ALIGNED(ocmem_pdata->size, PAGE_SIZE));
	BUG_ON(!IS_ALIGNED(ocmem_pdata->base, PAGE_SIZE));

	dev_info(dev, "OCMEM Virtual addr %p\n", ocmem_pdata->vbase);

	ocmem_core_clk = devm_clk_get(dev, "core_clk");

	if (IS_ERR(ocmem_core_clk)) {
@@ -824,10 +814,25 @@ static int msm_ocmem_probe(struct platform_device *pdev)
	if (IS_ERR_OR_NULL(ocmem_iface_clk))
		ocmem_iface_clk = NULL;

	if (!pdev->dev.of_node) {
		dev_info(dev, "Missing Configuration in Device Tree\n");
		ocmem_pdata = parse_static_config(pdev);
	} else {
		ocmem_pdata = parse_dt_config(pdev);
	}
	/* Check if we have some configuration data to start */
	if (!ocmem_pdata)
		return -ENODEV;

	ocmem_pdata->core_clk = ocmem_core_clk;
	ocmem_pdata->iface_clk = ocmem_iface_clk;

	/* Sanity Checks */
	BUG_ON(!IS_ALIGNED(ocmem_pdata->size, PAGE_SIZE));
	BUG_ON(!IS_ALIGNED(ocmem_pdata->base, PAGE_SIZE));

	dev_info(dev, "OCMEM Virtual addr %p\n", ocmem_pdata->vbase);

	platform_set_drvdata(pdev, ocmem_pdata);

	/* Parameter to be updated based on TZ */
@@ -858,6 +863,7 @@ static int msm_ocmem_probe(struct platform_device *pdev)
		return -EBUSY;
	}

	probe_done = true;
	dev_dbg(dev, "initialized successfully\n");
	return 0;
}
+12 −0
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@ struct ocmem_buf *ocmem_allocate(int client_id, unsigned long size)
	unsigned int delay;
	struct ocmem_zone *zone;

	if (!is_probe_done())
		return ERR_PTR(-EPROBE_DEFER);

	if (!check_id(client_id)) {
		pr_err("ocmem: Invalid client id: %d\n", client_id);
		return NULL;
@@ -169,6 +172,9 @@ struct ocmem_buf *ocmem_allocate_nowait(int client_id, unsigned long size)
	bool can_block = false;
	bool can_wait = false;

	if (!is_probe_done())
		return ERR_PTR(-EPROBE_DEFER);

	if (!check_id(client_id)) {
		pr_err("ocmem: Invalid client id: %d\n", client_id);
		return NULL;
@@ -202,6 +208,9 @@ struct ocmem_buf *ocmem_allocate_range(int client_id, unsigned long min,
	bool can_block = true;
	bool can_wait = false;

	if (!is_probe_done())
		return ERR_PTR(-EPROBE_DEFER);

	if (!check_id(client_id)) {
		pr_err("ocmem: Invalid client id: %d\n", client_id);
		return NULL;
@@ -242,6 +251,9 @@ struct ocmem_buf *ocmem_allocate_nb(int client_id, unsigned long size)
	bool can_block = true;
	bool can_wait = false;

	if (!is_probe_done())
		return ERR_PTR(-EPROBE_DEFER);

	if (!check_id(client_id)) {
		pr_err("ocmem: Invalid client id: %d\n", client_id);
		return NULL;
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -77,6 +77,9 @@ struct ocmem_notifier *ocmem_notifier_register(int client_id,
	int ret = 0;
	struct ocmem_notifier *nc_hndl = NULL;

	if (!is_probe_done())
		return ERR_PTR(-EPROBE_DEFER);

	if (!check_id(client_id)) {
		pr_err("ocmem: Invalid Client id\n");
		return NULL;