From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: gregkh@linuxfoundation.org
Cc: eric@anholt.net, stefan.wahren@i2se.com,
linux-rpi-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
robh+dt@kernel.org, tiwai@suse.de, nsaenzjulienne@suse.de
Subject: [PATCH 8/9] staging: vchiq_arm: add function to check if probe was successful
Date: Tue, 16 Oct 2018 17:02:27 +0200 [thread overview]
Message-ID: <20181016150228.16994-9-nsaenzjulienne@suse.de> (raw)
In-Reply-To: <20181016150228.16994-1-nsaenzjulienne@suse.de>
Devices depending on VCHIQ need to double check it's initialization
process was successful. This patch adds a helper function to do so.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
.../staging/vc04_services/interface/vchi/vchi.h | 3 +++
.../interface/vchiq_arm/vchiq_2835_arm.c | 2 ++
.../interface/vchiq_arm/vchiq_arm.c | 16 ++++++++++++++++
.../interface/vchiq_arm/vchiq_arm.h | 1 +
.../vc04_services/interface/vchiq_arm/vchiq_if.h | 4 ++++
.../interface/vchiq_arm/vchiq_shim.c | 7 +++++++
6 files changed, 33 insertions(+)
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 01381904775d..acf01352135f 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -113,6 +113,9 @@ extern uint32_t vchi_current_time(VCHI_INSTANCE_T instance_handle);
/******************************************************************************
Global service API
*****************************************************************************/
+// Routine to check if vchi is ready
+extern bool vchi_ready(struct device_node *firmware_node);
+
// Routine to create a named service
extern int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
SERVICE_CREATION_T *setup,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 83d740feab96..31dd8a303a20 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -194,6 +194,8 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state)
}
g_dev = dev;
+ drvdata->ready = 1;
+
vchiq_log_info(vchiq_arm_log_level,
"vchiq_init - done (slots %pK, phys %pad)",
vchiq_slot_zero, &slot_phys);
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index ea789376de0f..2690e751d1a5 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -3682,6 +3682,22 @@ static int vchiq_remove(struct platform_device *pdev)
return 0;
}
+bool vchiq_ready(struct device_node *firmware_node)
+{
+ struct platform_device *pdev = of_find_device_by_node(firmware_node);
+ struct vchiq_drvdata *drvdata;
+
+ if (!pdev)
+ return false;
+
+ drvdata = platform_get_drvdata(pdev);
+ if (!drvdata)
+ return false;
+
+ return drvdata->ready;
+}
+EXPORT_SYMBOL_GPL(vchiq_ready);
+
static struct platform_driver vchiq_driver = {
.driver = {
.name = "bcm2835_vchiq",
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
index 2f3ebc99cbcf..8215904d219b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
@@ -126,6 +126,7 @@ typedef struct vchiq_arm_state_struct {
struct vchiq_drvdata {
const unsigned int cache_line_size;
struct rpi_firmware *fw;
+ unsigned int ready:1;
};
extern int vchiq_arm_log_level;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index e4109a83e628..54ba822f38ff 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -34,6 +34,8 @@
#ifndef VCHIQ_IF_H
#define VCHIQ_IF_H
+#include <linux/of.h>
+
#include "interface/vchi/vchi_mh.h"
#define VCHIQ_SERVICE_HANDLE_INVALID 0
@@ -179,4 +181,6 @@ extern VCHIQ_STATUS_T vchiq_dump_phys_mem(VCHIQ_SERVICE_HANDLE_T service,
extern VCHIQ_STATUS_T vchiq_get_peer_version(VCHIQ_SERVICE_HANDLE_T handle,
short *peer_version);
+extern bool vchiq_ready(struct device_node *firmware_node);
+
#endif /* VCHIQ_IF_H */
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index c3223fcdaf87..69fdface29fd 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -32,6 +32,7 @@
*/
#include <linux/module.h>
#include <linux/types.h>
+#include <linux/of.h>
#include "interface/vchi/vchi.h"
#include "vchiq.h"
@@ -50,6 +51,12 @@ struct shim_service {
void *callback_param;
};
+bool vchi_ready(struct device_node *firmware_node)
+{
+ return vchiq_ready(firmware_node);
+}
+EXPORT_SYMBOL(vchi_ready);
+
/***********************************************************
* Name: vchi_msg_peek
*
--
2.19.1
next prev parent reply other threads:[~2018-10-16 15:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 15:02 [PATCH 0/9] staging: bcm2835-audio: Cleanups and upgrades Nicolas Saenz Julienne
2018-10-16 15:02 ` [PATCH 1/9] staging: bcm2835-audio: unify FOURCC command definitions Nicolas Saenz Julienne
2018-10-16 15:02 ` [PATCH 2/9] staging: bcm2835-audio: don't initialize memory twice Nicolas Saenz Julienne
2018-10-16 15:02 ` [PATCH 3/9] staging: bcm2835-audio: reorder variable declarations & remove trivial comments Nicolas Saenz Julienne
2018-10-16 15:02 ` [PATCH 4/9] staging: bcm2835-audio: use anonymous union in struct vc_audio_msg Nicolas Saenz Julienne
2018-10-16 15:02 ` [PATCH 5/9] staging: bcm2835-audio: more generic probe function name Nicolas Saenz Julienne
2018-10-16 15:47 ` Takashi Iwai
2018-10-16 15:02 ` [PATCH 6/9] ASoC: dt-bindings: bcm2835-rpi: add onboard audio bindings Nicolas Saenz Julienne
2018-10-16 15:56 ` Stefan Wahren
2018-10-16 16:48 ` Nicolas Saenz Julienne
2018-10-16 19:26 ` Stefan Wahren
2018-10-16 15:02 ` [PATCH 7/9] ARM: dts: bcm2835-rpi: add onboard audio device Nicolas Saenz Julienne
2018-10-16 16:18 ` Eric Anholt
2018-10-16 15:02 ` Nicolas Saenz Julienne [this message]
2018-10-16 15:02 ` [PATCH 9/9] staging: bcm2835-audio: check for VCHIQ during probe Nicolas Saenz Julienne
2018-10-16 15:47 ` [PATCH 0/9] staging: bcm2835-audio: Cleanups and upgrades Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181016150228.16994-9-nsaenzjulienne@suse.de \
--to=nsaenzjulienne@suse.de \
--cc=devicetree@vger.kernel.org \
--cc=eric@anholt.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=robh+dt@kernel.org \
--cc=stefan.wahren@i2se.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).