Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1701349

Re: [PATCH v3] serio: PS/2 gpio bit banging driver for the serio bus

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3] serio: PS/2 gpio bit banging driver for the serio bus
Date 2017-08-01 21:10 +0200
Message-ID <u9KIi-7WV-15@gated-at.bofh.it> (permalink)
References <u9wYF-6ZP-1@gated-at.bofh.it> <u9Jjc-6XQ-19@gated-at.bofh.it> <u9KyB-7DW-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Aug 01, 2017 at 08:51:40PM +0200, danilokrummrich@dk-develop.de wrote:
> On 2017-08-01 19:32, Dmitry Torokhov wrote:
> >On Tue, Aug 01, 2017 at 06:26:14AM +0200, Danilo Krummrich wrote:
> >>+	irq = gpio_to_irq(drvdata->gpio_clk);
> >>+	if (!irq) {
> >>+		dev_err(dev, "cannot get irq from gpio %u\n",
> >>+			drvdata->gpio_clk);
> >>+		error = -ENXIO;
> >>+		goto err_free_serio;
> >>+	}
> >
> >
> >IRQ line does not have to be the same as GPIO pin. Describe it
> >separately in device properties and just do:
> >
> >	irq = platform_get_irq(pdev, 0);
> >
> >and use it in the request below.
> >
> In which constellation can they be different?

IIRC there are controllers that may not let you re-configure GPIO that
is reserved for interrupt, for output. So you could have a bit of
hardware logic that splits and isolates GPIO and interrupt line.

Also have the trigger come from the interrupt description as well in
case you happen to have inverter logic there.

> >>+
> >>+	error = devm_request_irq(dev, irq, ps2_gpio_irq, IRQF_NO_THREAD |
> >>+			IRQF_TRIGGER_FALLING, DRIVER_NAME, drvdata);
> >
> >This will not work if GPIO is behind I2C or other slow bus. Is it
> >essential that there is no scheduling delay here?
> >
> Yes it is. You are right, this wouldn't work. Was this the scenario
> you had in mind while
> writing the comment above?

No, that was just a general comment about GPIO on slow busses. You might
need to check gpiod_can_sleep() and abort driver load if gpio is
sleeping.

Thanks.

-- 
Dmitry

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3] serio: PS/2 gpio bit banging driver for the serio bus Danilo Krummrich <danilokrummrich@dk-develop.de> - 2017-08-01 06:30 +0200
  Re: [PATCH v3] serio: PS/2 gpio bit banging driver for the serio bus Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-08-01 19:40 +0200
    Re: [PATCH v3] serio: PS/2 gpio bit banging driver for the serio bus danilokrummrich@dk-develop.de - 2017-08-01 21:00 +0200
      Re: [PATCH v3] serio: PS/2 gpio bit banging driver for the serio bus Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-08-01 21:10 +0200
        Re: [PATCH v3] serio: PS/2 gpio bit banging driver for the serio bus danilokrummrich@dk-develop.de - 2017-08-01 21:30 +0200
  Re: [PATCH v3] serio: PS/2 gpio bit banging driver for the serio bus kbuild test robot <lkp@intel.com> - 2017-08-03 18:30 +0200

csiph-web