From: <sean.wang@mediatek.com>
To: <linus.walleij@linaro.org>, <linux-mediatek@lists.infradead.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Sean Wang <sean.wang@mediatek.com>
Subject: [PATCH v2 15/22] pinctrl: mediatek: adjust error code and message when some register not supported is found
Date: Sat, 8 Sep 2018 19:07:31 +0800 [thread overview]
Message-ID: <2873ce93abf93d31a160c7dcbf5b3ff42c5e3886.1536404280.git.sean.wang@mediatek.com> (raw)
In-Reply-To: <cover.1536404280.git.sean.wang@mediatek.com>
From: Sean Wang <sean.wang@mediatek.com>
It's usual and not an error for there's some register not supported by a
certain SoC or a pin so that in the case we have to adjust the message to
print and the error code to get rid of unnecessary false alarm.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 35 ++++++++++++------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index 18a3548..7cdd46f 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -61,12 +61,21 @@ void mtk_rmw(struct mtk_pinctrl *pctl, u8 i, u32 reg, u32 mask, u32 set)
static int mtk_hw_pin_field_lookup(struct mtk_pinctrl *hw,
const struct mtk_pin_desc *desc,
- const struct mtk_pin_reg_calc *rc,
- struct mtk_pin_field *pfd)
+ int field, struct mtk_pin_field *pfd)
{
const struct mtk_pin_field_calc *c, *e;
+ const struct mtk_pin_reg_calc *rc;
u32 bits;
+ if (hw->soc->reg_cal && hw->soc->reg_cal[field].range) {
+ rc = &hw->soc->reg_cal[field];
+ } else {
+ dev_dbg(hw->dev,
+ "Not support field %d for pin %d (%s)\n",
+ field, desc->number, desc->name);
+ return -ENOTSUPP;
+ }
+
c = rc->range;
e = c + rc->nranges;
@@ -77,14 +86,15 @@ static int mtk_hw_pin_field_lookup(struct mtk_pinctrl *hw,
}
if (c >= e) {
- dev_err(hw->dev, "Out of range for pin = %d (%s)\n",
- desc->number, desc->name);
- return -EINVAL;
+ dev_dbg(hw->dev, "Not support field %d for pin = %d (%s)\n",
+ field, desc->number, desc->name);
+ return -ENOTSUPP;
}
if (c->i_base > hw->nbase - 1) {
- dev_err(hw->dev, "Invalid base is found for pin = %d (%s)\n",
- desc->number, desc->name);
+ dev_err(hw->dev,
+ "Invalid base for field %d for pin = %d (%s)\n",
+ field, desc->number, desc->name);
return -EINVAL;
}
@@ -116,21 +126,12 @@ static int mtk_hw_pin_field_get(struct mtk_pinctrl *hw,
const struct mtk_pin_desc *desc,
int field, struct mtk_pin_field *pfd)
{
- const struct mtk_pin_reg_calc *rc;
-
if (field < 0 || field >= PINCTRL_PIN_REG_MAX) {
dev_err(hw->dev, "Invalid Field %d\n", field);
return -EINVAL;
}
- if (hw->soc->reg_cal && hw->soc->reg_cal[field].range) {
- rc = &hw->soc->reg_cal[field];
- } else {
- dev_err(hw->dev, "Undefined range for field %d\n", field);
- return -EINVAL;
- }
-
- return mtk_hw_pin_field_lookup(hw, desc, rc, pfd);
+ return mtk_hw_pin_field_lookup(hw, desc, field, pfd);
}
static void mtk_hw_bits_part(struct mtk_pin_field *pf, int *h, int *l)
--
2.7.4
next prev parent reply other threads:[~2018-09-08 11:07 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-08 11:07 [PATCH v2 00/22] Unify MediaTek pinctrl in preparation for MT8183 and MT6765 sean.wang
2018-09-08 11:07 ` [PATCH v2 03/22] pinctrl: mediatek: extend struct mtk_pin_field_calc to pinctrl-mtk-common-v2.c sean.wang
2018-09-18 19:43 ` Linus Walleij
2018-09-08 11:07 ` [PATCH v2 12/22] pinctrl: mediatek: add MT7623 pinctrl driver based on generic pinctrl binding sean.wang
2018-09-18 19:52 ` Linus Walleij
2018-09-08 11:07 ` [PATCH v2 13/22] pinctrl: mediatek: use pin descriptor all in pinctrl-mtk-common-v2.c sean.wang
2018-09-18 19:53 ` Linus Walleij
2018-09-08 11:07 ` [PATCH v2 14/22] pinctrl: mediatek: add multiple register bases support to pinctrl-mtk-common-v2.c sean.wang
2018-09-18 19:56 ` Linus Walleij
2018-09-08 11:07 ` sean.wang [this message]
2018-09-18 19:57 ` [PATCH v2 15/22] pinctrl: mediatek: adjust error code and message when some register not supported is found Linus Walleij
2018-09-08 11:07 ` [PATCH v2 16/22] pinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver depends on sean.wang
2018-09-18 19:58 ` Linus Walleij
2018-09-08 11:07 ` [PATCH v2 17/22] pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings sean.wang
2018-09-18 19:59 ` Linus Walleij
2018-09-08 11:07 ` [PATCH v2 18/22] pinctrl: mediatek: add MT8183 pinctrl driver sean.wang
2018-09-18 20:01 ` Linus Walleij
2018-09-08 11:07 ` [PATCH v2 19/22] pinctrl: mediatek: extend advanced pull support in pinctrl-mtk-common-v2.c sean.wang
2018-09-18 20:02 ` Linus Walleij
2018-09-08 11:07 ` [PATCH v2 20/22] pintcrl: mediatek: add pull tweaks for I2C related pins on MT8183 sean.wang
2018-09-18 20:03 ` Linus Walleij
2018-09-08 11:07 ` [PATCH v2 21/22] pinctrl: mediatek: extend eint build to pinctrl-mtk-common-v2.c sean.wang
2018-09-08 11:07 ` [PATCH v2 22/22] pinctrl: mediatek: add eint support to MT8183 pinctrl driver sean.wang
[not found] ` <75d8f8c745d60b49ee1ec60de7f776ef51f97f79.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:36 ` [PATCH v2 01/22] pinctrl: mediatek: add pinctrl-mtk-common-v2 for all MediaTek pinctrls Linus Walleij
[not found] ` <5001a940525e9da7b0e1ac1afead629e1373fe33.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:42 ` [PATCH v2 02/22] pinctrl: mediatek: add pinctrl-moore that implements the generic pinctrl dt-bindings Linus Walleij
[not found] ` <8afc61bff2a4146731e5696f440c0eeaaf0ea341.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:44 ` [PATCH v2 04/22] pinctrl: mediatek: extend struct mtk_pin_desc to pinctrl-mtk-common-v2.c Linus Walleij
[not found] ` <17ff79fcf3df7c7208b6cda6f207e5e96c4d6c7e.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:45 ` [PATCH v2 05/22] pinctrl: mediatek: extend struct mtk_pin_soc " Linus Walleij
[not found] ` <ffa1fc0c62bc9408524619c8b530759351fd366c.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:46 ` [PATCH v2 06/22] pinctrl: mediatek: add driving strength related support " Linus Walleij
[not found] ` <5a7880e3885ba8a1c51ca28a0753228eeeeb9ec7.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:47 ` [PATCH v2 07/22] pinctrl: mediatek: add drv register " Linus Walleij
[not found] ` <f5324a24d1a70c37a5e011f859ce90867e9ad3fb.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:48 ` [PATCH v2 08/22] pinctrl: mediatek: add pull related " Linus Walleij
[not found] ` <aa213c9af6f9261f2ba91055785f0058d615bc4d.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:49 ` [PATCH v2 09/22] pinctrl: mediatek: add advanced " Linus Walleij
[not found] ` <af007cdcec1d4e8512faf47182aa4b17b17c1093.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:50 ` [PATCH v2 10/22] pinctrl: mediatek: add ies register " Linus Walleij
[not found] ` <f698dee4dcac1b5acfde7133773f7dc1e8c40583.1536404280.git.sean.wang@mediatek.com>
2018-09-18 19:51 ` [PATCH v2 11/22] pinctrl: mediatek: add pullen, pullsel " Linus Walleij
2018-09-18 22:07 ` [PATCH v2 00/22] Unify MediaTek pinctrl in preparation for MT8183 and MT6765 Linus Walleij
2018-09-19 2:54 ` Sean Wang
2018-09-19 4:37 ` Manivannan Sadhasivam
2018-09-21 4:22 ` Sean Wang
2018-09-25 10:48 ` Matthias Brugger
2018-09-25 13:07 ` Manivannan Sadhasivam
2018-09-25 13:09 ` Manivannan Sadhasivam
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=2873ce93abf93d31a160c7dcbf5b3ff42c5e3886.1536404280.git.sean.wang@mediatek.com \
--to=sean.wang@mediatek.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
/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).