From patchwork Tue Aug 11 15:41:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 250715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E965C433E1 for ; Tue, 11 Aug 2020 15:44:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D7402087C for ; Tue, 11 Aug 2020 15:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597160641; bh=fDw2vapQW45GEAIC6jIOi73M8vhpNaPkN5x5Kic47FQ=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=DLZWebckRPV6qfTaeemiL039j+A9XUOf2vm3uqzZ9gtbU2CHlWV8SnIRLhaG7Ue0o 1sRw3yTPoz7XdxUtkQJMZBUnSABQk+DVrFGkr0MKI+NJ2uM9y1cPmlCZYasJzUHfuP R15mmH6GvZs6Pj5ODn8/Rfg5UBpCW9xaTBBq3k0E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729248AbgHKPnp (ORCPT ); Tue, 11 Aug 2020 11:43:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:47558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728952AbgHKPmF (ORCPT ); Tue, 11 Aug 2020 11:42:05 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D2CB21744; Tue, 11 Aug 2020 15:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597160523; bh=fDw2vapQW45GEAIC6jIOi73M8vhpNaPkN5x5Kic47FQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AtHl43FAlReYUvlkW+vyltfmLlwn6J7xS7c43W+dpaU7LJQEiJ/Md2HEGqKdivOwU mUXFq0mrUyxVfh9VvnhPED7d3QJjdDdO9tULV7jiZfI0Nvj6JsAd//ujDgZdBHIHOm bt5LL1gcGjja8eKqI1kKLRHmhJ7X/qD6GR8Nb9D0= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1k5WPZ-004bmk-LP; Tue, 11 Aug 2020 17:42:01 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Stephen Boyd , Mayulong , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/33] spmi: hisi-spmi-controller: add debug when values are read/write Date: Tue, 11 Aug 2020 17:41:38 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/spmi/hisi-spmi-controller.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/spmi/hisi-spmi-controller.c b/drivers/spmi/hisi-spmi-controller.c index cacd28150b49..e996114bc717 100644 --- a/drivers/spmi/hisi-spmi-controller.c +++ b/drivers/spmi/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 @@ static int spmi_read_cmd(struct spmi_controller *ctrl, 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");