From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752345AbdB1LOJ (ORCPT ); Tue, 28 Feb 2017 06:14:09 -0500 Received: from lucky1.263xmail.com ([211.157.147.132]:38642 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751989AbdB1LOF (ORCPT ); Tue, 28 Feb 2017 06:14:05 -0500 X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: david.wu@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: david.wu@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Subject: =?UTF-8?Q?Re:_[PATCH_v1_1/2]_pinctrl:_rockchip=ef=bc=9aAdd_input_sc?= =?UTF-8?Q?hmitt_support?= To: Heiko Stuebner References: <1487068541-14120-1-git-send-email-david.wu@rock-chips.com> <1487068541-14120-2-git-send-email-david.wu@rock-chips.com> <48027259.fqOrTqXNdI@phil> Cc: linus.walleij@linaro.org, huangtao@rock-chips.com, linux-rockchip@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org From: "David.Wu" Message-ID: Date: Tue, 28 Feb 2017 19:12:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <48027259.fqOrTqXNdI@phil> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" >> >> 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 > > > >