linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>,
	robh+dt@kernel.org, mark.rutland@arm.com, mchehab@kernel.org,
	sakari.ailus@linux.intel.com, crope@iki.fi,
	chris.paterson2@renesas.com, geert+renesas@glider.be,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 2/5] media: i2c: max2175: Add MAX2175 support
Date: Fri, 11 Nov 2016 14:58:07 +0100	[thread overview]
Message-ID: <264196f6-6935-ecfb-33d8-1dd3a7894d26@xs4all.nl> (raw)
In-Reply-To: <1903855.3Xg5AI8ucK@avalon>

On 11/11/2016 02:48 PM, Laurent Pinchart wrote:
> Hi Hans,
> 
> On Friday 11 Nov 2016 14:21:22 Hans Verkuil wrote:
>> On 11/09/2016 04:44 PM, Ramesh Shanmugasundaram wrote:
>>> This patch adds driver support for MAX2175 chip. This is Maxim
>>> Integrated's RF to Bits tuner front end chip designed for software-defined
>>> radio solutions. This driver exposes the tuner as a sub-device instance
>>> with standard and custom controls to configure the device.
>>>
>>> Signed-off-by: Ramesh Shanmugasundaram
>>> <ramesh.shanmugasundaram@bp.renesas.com> ---
>>>
>>>  .../devicetree/bindings/media/i2c/max2175.txt      |   61 +
>>>  drivers/media/i2c/Kconfig                          |    4 +
>>>  drivers/media/i2c/Makefile                         |    2 +
>>>  drivers/media/i2c/max2175/Kconfig                  |    8 +
>>>  drivers/media/i2c/max2175/Makefile                 |    4 +
>>>  drivers/media/i2c/max2175/max2175.c                | 1558 +++++++++++++++
>>>  drivers/media/i2c/max2175/max2175.h                |  108 ++
>>>  7 files changed, 1745 insertions(+)
>>>  create mode 100644
>>>  Documentation/devicetree/bindings/media/i2c/max2175.txt
>>>  create mode 100644 drivers/media/i2c/max2175/Kconfig
>>>  create mode 100644 drivers/media/i2c/max2175/Makefile
>>>  create mode 100644 drivers/media/i2c/max2175/max2175.c
>>>  create mode 100644 drivers/media/i2c/max2175/max2175.h
>>
>> <snip>
>>
>>> diff --git a/drivers/media/i2c/max2175/max2175.c
>>> b/drivers/media/i2c/max2175/max2175.c new file mode 100644
>>> index 0000000..ec45b52
>>> --- /dev/null
>>> +++ b/drivers/media/i2c/max2175/max2175.c
>>> @@ -0,0 +1,1558 @@
>>
>> <snip>
>>
>>> +/* Read/Write bit(s) on top of regmap */
>>> +static int max2175_read(struct max2175 *ctx, u8 idx, u8 *val)
>>> +{
>>> +	u32 regval;
>>> +	int ret = regmap_read(ctx->regmap, idx, &regval);
>>> +
>>> +	if (ret)
>>> +		v4l2_err(ctx->client, "read ret(%d): idx 0x%02x\n", ret, idx);
> 
> By the way, I think I've seen a proposal to get rid of v4l2_err() in favour of 
> dev_err(), was I dreaming or should this patch use dev_err() already ?

I haven't seen anything, but I may have missed it. I haven't been on top of the
mailinglist lately. I'm fine with both.

> 
>>> +
>>> +	*val = regval;
>>
>> Does regmap_read initialize regval even if it returns an error? If not,
>> then I would initialize regval to 0 to prevent *val being uninitialized.
> 
> Better than that the error should be propagated to the caller and handled.
> 
>>> +	return ret;
>>> +}
> 
> [snip]
> 
>>> +static int max2175_band_from_freq(u32 freq)
>>> +{
>>> +	if (freq >= 144000 && freq <= 26100000)
>>> +		return MAX2175_BAND_AM;
>>> +	else if (freq >= 65000000 && freq <= 108000000)
>>> +		return MAX2175_BAND_FM;
>>> +	else
>>
>> No need for these 'else' keywords.
> 
> Indeed by in my opinion they improve readability :-)
> 
>>> +		return MAX2175_BAND_VHF;
>>> +}
> 
> [snip]
> 
>>> +static const struct v4l2_ctrl_config max2175_na_rx_mode = {
>>> +	.ops = &max2175_ctrl_ops,
>>> +	.id = V4L2_CID_MAX2175_RX_MODE,
>>> +	.name = "RX MODE",
>>> +	.type = V4L2_CTRL_TYPE_MENU,
>>> +	.max = ARRAY_SIZE(max2175_ctrl_na_rx_modes) - 1,
>>> +	.def = 0,
>>> +	.qmenu = max2175_ctrl_na_rx_modes,
>>> +};
>>
>> Please document all these controls better. This is part of the public API,
>> so you need to give more information what this means exactly.
> 
> Should that go to Documentation/media/v4l-drivers/ ? If so "[PATCH v4 3/4] 
> v4l: Add Renesas R-Car FDP1 Driver" can be used as an example.

I think that's the preferred place going forward. But a comment should be
added here pointing to that file so there is a better chance of keeping
the doc and code in sync.

> 
> [snip]
> 

	Hans

  reply	other threads:[~2016-11-11 13:58 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 15:44 [PATCH 0/5] Add V4L2 SDR (DRIF & MAX2175) driver Ramesh Shanmugasundaram
2016-11-09 15:44 ` [PATCH 1/5] media: v4l2-ctrls: Reserve controls for MAX217X Ramesh Shanmugasundaram
2016-11-09 15:44 ` [PATCH 2/5] media: i2c: max2175: Add MAX2175 support Ramesh Shanmugasundaram
2016-11-11  7:16   ` Antti Palosaari
2016-11-11 11:50     ` Laurent Pinchart
2016-11-11 13:21   ` Hans Verkuil
2016-11-11 13:48     ` Laurent Pinchart
2016-11-11 13:58       ` Hans Verkuil [this message]
2016-11-14 15:54     ` Ramesh Shanmugasundaram
2016-11-14 19:41   ` Rob Herring
2016-11-17 12:41     ` Ramesh Shanmugasundaram
2016-11-09 15:44 ` [PATCH 3/5] media: Add new SDR formats SC16, SC18 & SC20 Ramesh Shanmugasundaram
2016-11-11 13:24   ` Hans Verkuil
2016-11-11 13:48     ` Laurent Pinchart
2016-11-11 13:49     ` Laurent Pinchart
2016-11-14 16:20     ` Ramesh Shanmugasundaram
2016-11-14 16:52       ` Hans Verkuil
2016-11-09 15:44 ` [PATCH 4/5] doc_rst: media: New " Ramesh Shanmugasundaram
2016-11-10  8:18   ` Laurent Pinchart
2016-11-09 15:44 ` [PATCH 5/5] media: platform: rcar_drif: Add DRIF support Ramesh Shanmugasundaram
2016-11-10  9:22   ` Laurent Pinchart
2016-11-14 19:52     ` Rob Herring
2016-11-14 20:04       ` Geert Uytterhoeven
2016-11-15 15:09         ` Ramesh Shanmugasundaram
2016-11-11 13:38   ` Hans Verkuil
2016-11-14 16:11     ` Ramesh Shanmugasundaram
2016-12-21  8:10 ` [PATCH v2 0/7] Add V4L2 SDR (DRIF & MAX2175) driver Ramesh Shanmugasundaram
2016-12-21  8:10   ` [PATCH v2 1/7] media: v4l2-ctrls: Reserve controls for MAX217X Ramesh Shanmugasundaram
2016-12-21  8:10   ` [PATCH v2 2/7] dt-bindings: media: Add MAX2175 binding description Ramesh Shanmugasundaram
2016-12-21  8:10   ` [PATCH v2 3/7] media: i2c: max2175: Add MAX2175 support Ramesh Shanmugasundaram
2016-12-21  8:10   ` [PATCH v2 4/7] media: Add new SDR formats PC16, PC18 & PC20 Ramesh Shanmugasundaram
2016-12-21  8:10   ` [PATCH v2 5/7] doc_rst: media: New " Ramesh Shanmugasundaram
2016-12-21  8:10   ` [PATCH v2 6/7] dt-bindings: media: Add Renesas R-Car DRIF binding Ramesh Shanmugasundaram
2016-12-22 17:05     ` Laurent Pinchart
2016-12-22 19:05       ` Geert Uytterhoeven
2017-01-03 15:20         ` Ramesh Shanmugasundaram
2017-01-09 13:36           ` Hans Verkuil
2017-01-09 14:42             ` Ramesh Shanmugasundaram
2017-01-09 23:09             ` Laurent Pinchart
2017-01-10  9:31               ` Ramesh Shanmugasundaram
2017-01-19 17:46                 ` Chris Paterson
2017-01-27 11:20                 ` Hans Verkuil
2017-01-27 13:51                   ` Ramesh Shanmugasundaram
2016-12-21  8:10   ` [PATCH v2 7/7] media: platform: rcar_drif: Add DRIF support Ramesh Shanmugasundaram

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=264196f6-6935-ecfb-33d8-1dd3a7894d26@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=chris.paterson2@renesas.com \
    --cc=crope@iki.fi \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mchehab@kernel.org \
    --cc=ramesh.shanmugasundaram@bp.renesas.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /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).