From: "David.Wu" <david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org> To: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org> Cc: huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: Re: [PATCH v1 1/2] pinctrl: rockchip:Add input schmitt support Date: Tue, 28 Feb 2017 19:12:19 +0800 [thread overview] Message-ID: <dd65cf84-dc24-d9d1-9147-582eef3acbac@rock-chips.com> (raw) In-Reply-To: <48027259.fqOrTqXNdI@phil> Hi Heiko, 在 2017/2/24 0:51, Heiko Stuebner 写道: > Hi David, > > Am Dienstag, 14. Februar 2017, 18:35:40 CET schrieb David Wu: >> From: "david.wu" <david.wu@rock-chips.com> >> >> struct rockchip_pin_config { >> @@ -1355,6 +1358,53 @@ static int rockchip_set_pull(struct rockchip_pin_bank >> *bank, return ret; >> } >> >> +static int rockchip_get_schmitt(struct rockchip_pin_bank *bank, int >> pin_num) +{ >> + struct rockchip_pinctrl *info = bank->drvdata; >> + struct rockchip_pin_ctrl *ctrl = info->ctrl; >> + struct regmap *regmap; >> + int reg, ret; >> + u8 bit; >> + u32 data; >> + >> + ctrl->schmitt_calc_reg(bank, pin_num, ®map, ®, &bit); > > we might want to have and check an actual return value here. > On things like the rk3288 only some special pins have these schmitt triggers > it seems, so we might want to abort if something tries to access an > unsupported one. Thanks, i forget to check the return value. > >> + >> + ret = regmap_read(regmap, reg, &data); >> + if (ret) >> + return ret; >> + >> + data >>= bit; >> + return data & 0x1; > > The mask seems to also be variable, for example on the rk3399 there seem to be > multiple "levels" for at least gpio2. So your calc-callback might want to also > set the right mask. To the multiple "levels", i think we can use the "PIN_CONFIG_INPUT_SCHMITT" pin config, which described at pinconf-generic.h. * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, * the threshold value is given on a custom format as argument when * setting pins to this mode. > > Otherwise looks good. > > > Heiko > > > > _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip
WARNING: multiple messages have this Message-ID (diff)
From: "David.Wu" <david.wu@rock-chips.com> To: Heiko Stuebner <heiko@sntech.de> Cc: linus.walleij@linaro.org, huangtao@rock-chips.com, linux-rockchip@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/2] pinctrl: rockchip:Add input schmitt support Date: Tue, 28 Feb 2017 19:12:19 +0800 [thread overview] Message-ID: <dd65cf84-dc24-d9d1-9147-582eef3acbac@rock-chips.com> (raw) In-Reply-To: <48027259.fqOrTqXNdI@phil> Hi Heiko, 在 2017/2/24 0:51, Heiko Stuebner 写道: > Hi David, > > Am Dienstag, 14. Februar 2017, 18:35:40 CET schrieb David Wu: >> From: "david.wu" <david.wu@rock-chips.com> >> >> struct rockchip_pin_config { >> @@ -1355,6 +1358,53 @@ static int rockchip_set_pull(struct rockchip_pin_bank >> *bank, return ret; >> } >> >> +static int rockchip_get_schmitt(struct rockchip_pin_bank *bank, int >> pin_num) +{ >> + struct rockchip_pinctrl *info = bank->drvdata; >> + struct rockchip_pin_ctrl *ctrl = info->ctrl; >> + struct regmap *regmap; >> + int reg, ret; >> + u8 bit; >> + u32 data; >> + >> + ctrl->schmitt_calc_reg(bank, pin_num, ®map, ®, &bit); > > we might want to have and check an actual return value here. > On things like the rk3288 only some special pins have these schmitt triggers > it seems, so we might want to abort if something tries to access an > unsupported one. Thanks, i forget to check the return value. > >> + >> + ret = regmap_read(regmap, reg, &data); >> + if (ret) >> + return ret; >> + >> + data >>= bit; >> + return data & 0x1; > > The mask seems to also be variable, for example on the rk3399 there seem to be > multiple "levels" for at least gpio2. So your calc-callback might want to also > set the right mask. To the multiple "levels", i think we can use the "PIN_CONFIG_INPUT_SCHMITT" pin config, which described at pinconf-generic.h. * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, * the threshold value is given on a custom format as argument when * setting pins to this mode. > > Otherwise looks good. > > > Heiko > > > >
next prev parent reply other threads:[~2017-02-28 11:12 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-14 10:35 [PATCH v1 0/2] Add pinctrl input schmitt support David Wu [not found] ` <1487068541-14120-1-git-send-email-david.wu-TNX95d0MmH7DzftRWevZcw@public.gmane.org> 2017-02-14 10:35 ` [PATCH v1 1/2] pinctrl: rockchip:Add " David Wu 2017-02-14 10:35 ` David Wu 2017-02-23 16:51 ` Heiko Stuebner 2017-02-28 11:12 ` David.Wu [this message] 2017-02-28 11:12 ` David.Wu 2017-02-14 10:35 ` [PATCH v1 2/2] pinctrl: rockchip: Add input schmitt support for rk3328 David Wu 2017-02-23 16:53 ` Heiko Stuebner 2017-02-22 15:04 ` [PATCH v1 0/2] Add pinctrl input schmitt support Linus Walleij
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=dd65cf84-dc24-d9d1-9147-582eef3acbac@rock-chips.com \ --to=david.wu-tnx95d0mmh7dzftrwevzcw@public.gmane.org \ --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \ --cc=huangtao-TNX95d0MmH7DzftRWevZcw@public.gmane.org \ --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \ --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.