linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurentiu Palcu <laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Johan Havold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Octavian Purdila
	<octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v6 1/2] spi: add support for DLN-2 USB-SPI adapter
Date: Thu, 27 Nov 2014 12:30:35 +0200	[thread overview]
Message-ID: <20141127103034.GP2583@lpalcu-linux> (raw)
In-Reply-To: <20141126182521.GP7712-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>

On Wed, Nov 26, 2014 at 06:25:21PM +0000, Mark Brown wrote:
> On Wed, Nov 26, 2014 at 12:09:09PM +0200, Laurentiu Palcu wrote:
> 
> > +static int dln2_spi_transfer_one_message(struct spi_master *master,
> > +					 struct spi_message *msg)
> > +{
> > +	struct dln2_spi *dln2 = spi_master_get_devdata(master);
> > +	struct spi_device *spi = msg->spi;
> > +	struct spi_transfer *xfer;
> > +	int status;
> > +
> > +	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
> > +		u8 attr = 0;
> > +
> > +		status = dln2_spi_transfer_setup(dln2, xfer->speed_hz,
> > +						 xfer->bits_per_word,
> > +						 spi->mode);
> > +		if (status < 0) {
> > +			dev_err(&dln2->pdev->dev, "Cannot setup transfer\n");
> > +			break;
> > +		}
> > +
> > +		if (!xfer->cs_change &&
> > +		    !list_is_last(&xfer->transfer_list, &msg->transfers))
> > +			attr = xfer->cs_change ? 0 : DLN2_SPI_ATTR_LEAVE_SS_LOW;
> > +
> > +		status = dln2_spi_rdwr(dln2, xfer->tx_buf, xfer->rx_buf,
> > +				       xfer->len, attr);
> 
> We recently added a spi_transfer_is_last() operation which should allow
> you to move this to using transfer_one() which is a bit nicer.
Ok, sounds good!

> 
> > +	/* enable SPI module, we're good to go */
> > +	ret = dln2_spi_enable(dln2, true);
> > +	if (ret < 0) {
> > +		dev_err(&pdev->dev, "Failed to enable SPI module\n");
> > +		goto exit_free_master;
> > +	}
> 
> It would be nice to have runtime PM operations which keep the device
> disabled when idle, presumably that'd save a bit of power and it's
> generally better practice.
I'll add runtime PM and send a v7.

laurentiu
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-11-27 10:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 12:09 [PATCH v3 0/2] Add SPI support for Diolan DLN2 Laurentiu Palcu
2014-11-18 12:09 ` [PATCH v3 1/2] spi: add support for DLN-2 USB-SPI adapter Laurentiu Palcu
     [not found]   ` <1416312599-5176-2-git-send-email-laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-18 17:06     ` Johan Hovold
2014-11-19  9:53       ` Laurentiu Palcu
2014-11-19 10:09         ` Johan Hovold
2014-11-19 10:47     ` [PATCH v4 " Laurentiu Palcu
     [not found]       ` <1416394031-2663-1-git-send-email-laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-19 12:21         ` Johan Hovold
2014-11-19 13:07         ` [PATCH v5 " Laurentiu Palcu
     [not found]           ` <1416402467-26999-1-git-send-email-laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-19 13:51             ` Johan Hovold
2014-11-19 14:12               ` Laurentiu Palcu
2014-11-26 10:09   ` [PATCH v6 " Laurentiu Palcu
     [not found]     ` <1416996549-29328-1-git-send-email-laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-26 18:25       ` Mark Brown
     [not found]         ` <20141126182521.GP7712-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-11-27 10:30           ` Laurentiu Palcu [this message]
2014-11-28 13:09   ` [PATCH v7 " Laurentiu Palcu
2014-11-28 14:10     ` Mark Brown
     [not found]       ` <20141128141053.GL7712-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-11-28 14:57         ` Laurentiu Palcu
2014-11-28 15:14           ` Mark Brown
     [not found]             ` <20141128151435.GQ7712-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-11-28 15:31               ` Laurentiu Palcu
2014-11-28 16:01                 ` Mark Brown
     [not found]                   ` <20141128160156.GX7712-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-11-28 18:13                     ` Laurentiu Palcu
2014-11-28 18:35                       ` Mark Brown
     [not found]                         ` <20141128183507.GZ7712-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-11-28 19:27                           ` Laurentiu Palcu
2014-11-28 19:46                             ` Mark Brown
2014-11-28 19:21                       ` Octavian Purdila
     [not found]     ` <1417180198-9393-1-git-send-email-laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-05 18:34       ` Mark Brown
     [not found] ` <1416312599-5176-1-git-send-email-laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-18 12:09   ` [PATCH v3 2/2] mfd: dln2: add support for USB-SPI module Laurentiu Palcu
     [not found]     ` <1416312599-5176-3-git-send-email-laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-19 16:29       ` Lee Jones

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=20141127103034.GP2583@lpalcu-linux \
    --to=laurentiu.palcu-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=sameo-VuQAYsv1563Yd54FQh9/CA@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: 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).