summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-08-17 09:10:26 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-18 16:15:23 +0200
commit6af364501949d9978252a5c0d4f2363f1cf45dcc (patch)
tree457e23625aacbfba53dc5d5951964b8e7df9f164
parent8788a30c12c78846c153bea06125296111f53ece (diff)
downloadlinux-6af364501949d9978252a5c0d4f2363f1cf45dcc.tar.bz2
staging: spmi: hisi-spmi-controller: add debug when values are read/write
It is interesting to be able to check if the driver is doing the right thing. So, add some debug macros to allow checking it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/11dc4583c41a9c5e2804114d6a7a87374d2a23b4.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/hikey9xx/hisi-spmi-controller.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/staging/hikey9xx/hisi-spmi-controller.c b/drivers/staging/hikey9xx/hisi-spmi-controller.c
index cacd28150b49..e996114bc717 100644
--- a/drivers/staging/hikey9xx/hisi-spmi-controller.c
+++ b/drivers/staging/hikey9xx/hisi-spmi-controller.c
@@ -41,7 +41,6 @@
#define SPMI_APB_SPMI_CMD_EN BIT(31)
#define SPMI_APB_SPMI_CMD_TYPE_OFFSET 24
#define SPMI_APB_SPMI_CMD_LENGTH_OFFSET 20
-
#define SPMI_APB_SPMI_CMD_SLAVEID_OFFSET 16
#define SPMI_APB_SPMI_CMD_ADDR_OFFSET 0
@@ -135,10 +134,11 @@ static int spmi_controller_wait_for_done(struct spmi_controller_dev *ctrl_dev,
}
static int spmi_read_cmd(struct spmi_controller *ctrl,
- u8 opc, u8 sid, u16 addr, u8 *buf, size_t bc)
+ u8 opc, u8 sid, u16 addr, u8 *__buf, size_t bc)
{
struct spmi_controller_dev *spmi_controller = dev_get_drvdata(&ctrl->dev);
unsigned long flags;
+ u8 *buf = __buf;
u32 cmd, data;
int rc;
u32 chnl_ofst = SPMI_CHANNEL_OFFSET * spmi_controller->channel;
@@ -197,13 +197,18 @@ done:
if (rc)
dev_err(spmi_controller->dev, "spmi read wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
opc, sid, addr, bc + 1);
+ else
+ dev_dbg(spmi_controller->dev, "%s: id:%d addr:0x%x, read value: %*ph\n",
+ __func__, sid, addr, (int)bc, __buf);
+
return rc;
}
static int spmi_write_cmd(struct spmi_controller *ctrl,
- u8 opc, u8 sid, u16 addr, const u8 *buf, size_t bc)
+ u8 opc, u8 sid, u16 addr, const u8 *__buf, size_t bc)
{
struct spmi_controller_dev *spmi_controller = dev_get_drvdata(&ctrl->dev);
+ const u8 *buf = __buf;
unsigned long flags;
u32 cmd, data;
int rc;
@@ -263,6 +268,9 @@ static int spmi_write_cmd(struct spmi_controller *ctrl,
if (rc)
dev_err(spmi_controller->dev, "spmi write wait timeout op:0x%x sid:%d addr:0x%x bc:%ld\n",
opc, sid, addr, bc);
+ else
+ dev_dbg(spmi_controller->dev, "%s: id:%d addr:0x%x, wrote value: %*ph\n",
+ __func__, sid, addr, (int)bc, __buf);
return rc;
}
@@ -275,6 +283,7 @@ static int spmi_controller_probe(struct platform_device *pdev)
int ret = 0;
dev_info(&pdev->dev, "HISI SPMI probe\n");
+
ctrl = spmi_controller_alloc(&pdev->dev, sizeof(*spmi_controller));
if (!ctrl) {
dev_err(&pdev->dev, "can not allocate spmi_controller data\n");