* [PATCH v2 net-next 0/2] nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING @ 2020-12-08 14:10 Bongsu Jeon 2020-12-08 14:10 ` [PATCH v2 net-next 1/2] dt-bindings: net: nfc: s3fwrn5: Change I2C interrupt trigger type Bongsu Jeon ` (2 more replies) 0 siblings, 3 replies; 5+ messages in thread From: Bongsu Jeon @ 2020-12-08 14:10 UTC (permalink / raw) To: krzk; +Cc: linux-nfc, netdev, devicetree, linux-kernel, Bongsu Jeon From: Bongsu Jeon <bongsu.jeon@samsung.com> For stable Samsung's I2C interrupt handling, I changed the interrupt trigger from IRQ_TYPE_LEVEL_HIGH to IRQ_TYPE_EDGE_RISING and removed the hard coded interrupt trigger type in the i2c module for the flexible control. 1/2 is the changed dt binding for the edge rising trigger. 2/2 is to remove the hard coded interrupt trigger type in the i2c module. ChangeLog: v2: 2/2 - remove the hard coded interrupt trigger type. Bongsu Jeon (2): dt-bindings: net: nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING nfc: s3fwrn5: Remove hard coded interrupt trigger type from the i2c module .../devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml | 2 +- drivers/nfc/s3fwrn5/i2c.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 net-next 1/2] dt-bindings: net: nfc: s3fwrn5: Change I2C interrupt trigger type 2020-12-08 14:10 [PATCH v2 net-next 0/2] nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING Bongsu Jeon @ 2020-12-08 14:10 ` Bongsu Jeon 2020-12-08 14:10 ` [PATCH v2 net-next 2/2] nfc: s3fwrn5: Remove hard coded interrupt trigger type from the i2c module Bongsu Jeon 2020-12-10 0:52 ` [PATCH v2 net-next 0/2] nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING David Miller 2 siblings, 0 replies; 5+ messages in thread From: Bongsu Jeon @ 2020-12-08 14:10 UTC (permalink / raw) To: krzk; +Cc: linux-nfc, netdev, devicetree, linux-kernel, Bongsu Jeon From: Bongsu Jeon <bongsu.jeon@samsung.com> Change interrupt trigger from IRQ_TYPE_LEVEL_HIGH to IRQ_TYPE_EDGE_RISING for stable NFC I2C interrupt handling. Samsung's NFC Firmware sends an i2c frame as below. 1. NFC Firmware sets the GPIO(interrupt pin) high when there is an i2c frame to send. 2. If the CPU's I2C master has received the i2c frame, NFC F/W sets the GPIO low. NFC driver's i2c interrupt handler would be called in the abnormal case as the NFC FW task of number 2 is delayed because of other high priority tasks. In that case, NFC driver will try to receive the i2c frame but there isn't any i2c frame to send in NFC. It would cause an I2C communication problem. This case would hardly happen. But, I changed the interrupt as a defense code. If Driver uses the TRIGGER_RISING instead of the LEVEL trigger, there would be no problem even if the NFC FW task is delayed. Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com> --- Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml b/Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml index ca3904bf90e0..477066e2b821 100644 --- a/Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml +++ b/Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml @@ -76,7 +76,7 @@ examples: reg = <0x27>; interrupt-parent = <&gpa1>; - interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <3 IRQ_TYPE_EDGE_RISING>; en-gpios = <&gpf1 4 GPIO_ACTIVE_HIGH>; wake-gpios = <&gpj0 2 GPIO_ACTIVE_HIGH>; -- 2.17.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 net-next 2/2] nfc: s3fwrn5: Remove hard coded interrupt trigger type from the i2c module 2020-12-08 14:10 [PATCH v2 net-next 0/2] nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING Bongsu Jeon 2020-12-08 14:10 ` [PATCH v2 net-next 1/2] dt-bindings: net: nfc: s3fwrn5: Change I2C interrupt trigger type Bongsu Jeon @ 2020-12-08 14:10 ` Bongsu Jeon 2020-12-10 8:18 ` Krzysztof Kozlowski 2020-12-10 0:52 ` [PATCH v2 net-next 0/2] nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING David Miller 2 siblings, 1 reply; 5+ messages in thread From: Bongsu Jeon @ 2020-12-08 14:10 UTC (permalink / raw) To: krzk; +Cc: linux-nfc, netdev, devicetree, linux-kernel, Bongsu Jeon From: Bongsu Jeon <bongsu.jeon@samsung.com> For the flexible control of interrupt trigger type, remove the hard coded interrupt trigger type in the i2c module. The trigger type will be loaded from a dts. Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com> --- drivers/nfc/s3fwrn5/i2c.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c index e1bdde105f24..42f1f610ac2c 100644 --- a/drivers/nfc/s3fwrn5/i2c.c +++ b/drivers/nfc/s3fwrn5/i2c.c @@ -179,6 +179,8 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct s3fwrn5_i2c_phy *phy; + struct irq_data *irq_data; + unsigned long irqflags; int ret; phy = devm_kzalloc(&client->dev, sizeof(*phy), GFP_KERNEL); @@ -212,8 +214,11 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client, if (ret < 0) return ret; + irq_data = irq_get_irq_data(client->irq); + irqflags = irqd_get_trigger_type(irq_data) | IRQF_ONESHOT; + ret = devm_request_threaded_irq(&client->dev, phy->i2c_dev->irq, NULL, - s3fwrn5_i2c_irq_thread_fn, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, + s3fwrn5_i2c_irq_thread_fn, irqflags, S3FWRN5_I2C_DRIVER_NAME, phy); if (ret) s3fwrn5_remove(phy->common.ndev); -- 2.17.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 net-next 2/2] nfc: s3fwrn5: Remove hard coded interrupt trigger type from the i2c module 2020-12-08 14:10 ` [PATCH v2 net-next 2/2] nfc: s3fwrn5: Remove hard coded interrupt trigger type from the i2c module Bongsu Jeon @ 2020-12-10 8:18 ` Krzysztof Kozlowski 0 siblings, 0 replies; 5+ messages in thread From: Krzysztof Kozlowski @ 2020-12-10 8:18 UTC (permalink / raw) To: Bongsu Jeon; +Cc: linux-nfc, netdev, devicetree, linux-kernel, Bongsu Jeon On Tue, Dec 08, 2020 at 11:10:12PM +0900, Bongsu Jeon wrote: > From: Bongsu Jeon <bongsu.jeon@samsung.com> > > For the flexible control of interrupt trigger type, remove the hard coded > interrupt trigger type in the i2c module. The trigger type will be loaded > from a dts. > > Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com> > --- > drivers/nfc/s3fwrn5/i2c.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c > index e1bdde105f24..42f1f610ac2c 100644 > --- a/drivers/nfc/s3fwrn5/i2c.c > +++ b/drivers/nfc/s3fwrn5/i2c.c > @@ -179,6 +179,8 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client, > const struct i2c_device_id *id) > { > struct s3fwrn5_i2c_phy *phy; > + struct irq_data *irq_data; > + unsigned long irqflags; > int ret; > > phy = devm_kzalloc(&client->dev, sizeof(*phy), GFP_KERNEL); > @@ -212,8 +214,11 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client, > if (ret < 0) > return ret; > > + irq_data = irq_get_irq_data(client->irq); > + irqflags = irqd_get_trigger_type(irq_data) | IRQF_ONESHOT; This patch is wrong and should not be applied. David, please give few days to review the patches. :) The irqd_get_trigger_type is not necessary. I'll send follow ups to correct this. Best regards, Krzysztof > + > ret = devm_request_threaded_irq(&client->dev, phy->i2c_dev->irq, NULL, > - s3fwrn5_i2c_irq_thread_fn, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > + s3fwrn5_i2c_irq_thread_fn, irqflags, > S3FWRN5_I2C_DRIVER_NAME, phy); > if (ret) > s3fwrn5_remove(phy->common.ndev); > -- > 2.17.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 net-next 0/2] nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING 2020-12-08 14:10 [PATCH v2 net-next 0/2] nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING Bongsu Jeon 2020-12-08 14:10 ` [PATCH v2 net-next 1/2] dt-bindings: net: nfc: s3fwrn5: Change I2C interrupt trigger type Bongsu Jeon 2020-12-08 14:10 ` [PATCH v2 net-next 2/2] nfc: s3fwrn5: Remove hard coded interrupt trigger type from the i2c module Bongsu Jeon @ 2020-12-10 0:52 ` David Miller 2 siblings, 0 replies; 5+ messages in thread From: David Miller @ 2020-12-10 0:52 UTC (permalink / raw) To: bongsu.jeon2 Cc: krzk, linux-nfc, netdev, devicetree, linux-kernel, bongsu.jeon From: Bongsu Jeon <bongsu.jeon2@gmail.com> Date: Tue, 8 Dec 2020 23:10:10 +0900 > From: Bongsu Jeon <bongsu.jeon@samsung.com> > > For stable Samsung's I2C interrupt handling, I changed the interrupt > trigger from IRQ_TYPE_LEVEL_HIGH to IRQ_TYPE_EDGE_RISING and removed > the hard coded interrupt trigger type in the i2c module for the flexible > control. > > 1/2 is the changed dt binding for the edge rising trigger. > 2/2 is to remove the hard coded interrupt trigger type in the i2c module. > > ChangeLog: > v2: > 2/2 > - remove the hard coded interrupt trigger type. Series applied, thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-10 8:19 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-12-08 14:10 [PATCH v2 net-next 0/2] nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING Bongsu Jeon 2020-12-08 14:10 ` [PATCH v2 net-next 1/2] dt-bindings: net: nfc: s3fwrn5: Change I2C interrupt trigger type Bongsu Jeon 2020-12-08 14:10 ` [PATCH v2 net-next 2/2] nfc: s3fwrn5: Remove hard coded interrupt trigger type from the i2c module Bongsu Jeon 2020-12-10 8:18 ` Krzysztof Kozlowski 2020-12-10 0:52 ` [PATCH v2 net-next 0/2] nfc: s3fwrn5: Change I2C interrupt trigger to EDGE_RISING David Miller
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).