From: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
To: Peter Meerwald-Stadler <pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org>
Cc: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Hartmut Knaack <knaack.h-Mmb7MZpHnFY@public.gmane.org>,
Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Marcel Partap <mpartap-hi6Y0CQ0nG0@public.gmane.org>,
Michael Scott
<michael.scott-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH] iio: adc: cpcap: Add minimal support for CPCAP PMIC ADC
Date: Sun, 19 Mar 2017 09:06:16 -0700 [thread overview]
Message-ID: <20170319160616.GY20572@atomide.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1703170721350.2053-M0QeDd4q1oXQbIPoIc8EuQ@public.gmane.org>
Hi,
* Peter Meerwald-Stadler <pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org> [170316 23:44]:
> > Signed-off-by: Tony Lindgrne <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
>
> Lindgren
Hmm yeah there are slight variations to my signature it seems :)
...
> > +/* Register CPCAP_REG_ADCC1 bits */
> > +#define CPCAP_BIT_ADEN_AUTO_CLR BIT(15) /* Currently unused */
> > +#define CPCAP_BIT_CAL_MODE BIT(14) /* Set with BIT_RAND0 */
> > +#define CPCAP_BIT_ADC_CLK_SEL1 BIT(13) /* Currently unused */
> > +#define CPCAP_BIT_ADC_CLK_SEL0 BIT(12) /* Currently unused */
> > +#define CPCAP_BIT_ATOX BIT(11) /* in/out ps factor */
>
> wondering what a 'ps' factor is...
I guess I have no idea at this point with no documentation. I'll
just drop the comments for now for the mystery registers.
> > +#define CPCAP_CHAN(_type, _index, _address, _datasheet_name) { \
> > + .type = (_type), \
> > + .address = (_address), \
> > + .indexed = 1, \
> > + .channel = (_index), \
> > + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> > + BIT(IIO_CHAN_INFO_SCALE), \
> > + .info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ) | \
> > + BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO), \
>
> I don't see SAMP_FREQ and _OVERSAMPLING handled?
OK will drop for now.
> > + dev_info(ddata->dev,
> > + "cpcap_adc_probe: CHRGI Cal complete!\n");
>
> maybe calibration instead of Cal
Yup thanks, also can use __func__ or just driver name.
> > + break;
> > + }
> > +
> > + msleep(5);
>
> I guess this will trigger a checkpatch warning
>
> > + i++;
> > + } while (i > 5);
>
> should be < 5????
> why not just use a for look?
Heheh yeah that looks really weird :) I guess I was too chicken to mess
with the calibration for the battery ADCs earlier so I tried to keep it
as it was in the Motorola driver. But now things are working and I can
compare the results so it should not be a problem.
> can't this code duplication be avoided?
Yeah so it seems, I'll take a look.
> > +/* Looks up temperatures in a table and calculates averages if needed */
> > +static unsigned short cpcap_adc_table_to_millicelcius(unsigned short value)
>
> why unsigned if it returns millicelcius, shouldn't this be int to cover
> the temperature rate?
Thanks yes. It was Kelvins in the Motorola driver.
Will fix up the rest of your comments and repost. Thanks for looking
and thanks for the good comments.
Regards,
Tony
next prev parent reply other threads:[~2017-03-19 16:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 1:43 [PATCH] iio: adc: cpcap: Add minimal support for CPCAP PMIC ADC Tony Lindgren
[not found] ` <20170317014344.27201-1-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-03-17 6:42 ` Peter Meerwald-Stadler
[not found] ` <alpine.DEB.2.20.1703170721350.2053-M0QeDd4q1oXQbIPoIc8EuQ@public.gmane.org>
2017-03-19 16:06 ` Tony Lindgren [this message]
2017-03-19 17:06 ` Jonathan Cameron
[not found] ` <fefdc8e7-3780-b149-7898-0a4f3f58efc3-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-19 17:54 ` Tony Lindgren
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=20170319160616.GY20572@atomide.com \
--to=tony-4v6ys6ai5vpbdgjk7y7tuq@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=knaack.h-Mmb7MZpHnFY@public.gmane.org \
--cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=michael.scott-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=mpartap-hi6Y0CQ0nG0@public.gmane.org \
--cc=pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org \
--cc=sre-DgEjT+Ai2ygdnm+yROfE0A@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).