From: Michael Welling <mwelling@ieee.org>
To: broonie@kernel.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Michael Welling <mwelling@ieee.org>
Subject: [PATCH v4 2/2] spi: omap2-mcspi: Add gpio_request and init CS
Date: Thu, 7 May 2015 18:36:54 -0500 [thread overview]
Message-ID: <1431041814-24757-3-git-send-email-mwelling@ieee.org> (raw)
In-Reply-To: <1431041814-24757-1-git-send-email-mwelling@ieee.org>
If GPIO chipselects are specified initialise the GPIO in the setup function.
Signed-off-by: Michael Welling <mwelling@ieee.org>
---
drivers/spi/spi-omap2-mcspi.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 3ac06ad..370c333 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -35,6 +35,7 @@
#include <linux/gcd.h>
#include <linux/spi/spi.h>
+#include <linux/gpio.h>
#include <linux/platform_data/spi-omap2-mcspi.h>
@@ -1015,6 +1016,12 @@ static int omap2_mcspi_setup(struct spi_device *spi)
if (ret < 0)
return ret;
+ if (gpio_is_valid(spi->cs_gpio)) {
+ if (gpio_request(spi->cs_gpio, dev_name(&spi->dev)) == 0)
+ gpio_direction_output(spi->cs_gpio,
+ !(spi->mode & SPI_CS_HIGH));
+ }
+
ret = omap2_mcspi_setup_transfer(spi, NULL);
pm_runtime_mark_last_busy(mcspi->dev);
pm_runtime_put_autosuspend(mcspi->dev);
--
1.7.9.5
next prev parent reply other threads:[~2015-05-07 23:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-07 23:36 [PATCH v4 0/2] spi: omap2-mcspi: Add support for GPIO chipselects Michael Welling
2015-05-07 23:36 ` [PATCH v4 1/2] spi: omap2-mcspi: Switch driver to use transfer_one Michael Welling
2015-05-08 16:59 ` Mark Brown
2015-05-07 23:36 ` Michael Welling [this message]
[not found] ` <1431041814-24757-3-git-send-email-mwelling-EkmVulN54Sk@public.gmane.org>
2015-05-08 17:09 ` [PATCH v4 2/2] spi: omap2-mcspi: Add gpio_request and init CS Mark Brown
[not found] ` <20150508170916.GD2761-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-05-08 17:37 ` Michael Welling
2015-05-08 17:53 ` Mark Brown
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=1431041814-24757-3-git-send-email-mwelling@ieee.org \
--to=mwelling@ieee.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.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).