mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Laszlo Papp <lpapp@kde.org>
Cc: jdelvare@suse.de, linux@roeck-us.net, lm-sensors@lm-sensors.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mfd: MAX6650/6651 support
Date: Fri, 14 Feb 2014 11:43:49 +0000	[thread overview]
Message-ID: <20140214114349.GG9462@lee--X1> (raw)
In-Reply-To: <1392369342-11472-2-git-send-email-lpapp@kde.org>

>From [PATCH 0/2]:
  What's the resaon for not testing this on h/w yet?

> MAX6650/MAX6651 chip is a multi-function device with I2C busses. The
> chip includes fan-speed regulators and monitors, GPIO, and alarm.
> 
> This patch is an initial release of a MAX6650/6651 MFD driver that
> supports to enable the chip with its primary I2C bus that will connect
> the hwmon, and then the gpio devices for now.
> 
> Signed-off-by: Laszlo Papp <lpapp@kde.org>
> ---
>  drivers/mfd/Kconfig                 | 11 +++++
>  drivers/mfd/Makefile                |  1 +
>  drivers/mfd/max665x.c               | 94 +++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/max665x-private.h | 34 ++++++++++++++
>  4 files changed, 140 insertions(+)
>  create mode 100644 drivers/mfd/max665x.c
>  create mode 100644 include/linux/mfd/max665x-private.h

<snip>

> +++ b/drivers/mfd/max665x.c
> @@ -0,0 +1,94 @@
> +/*
> + * Device access for MAX6650-MAX6651

Nit: Prefer "for Maxim MAX6650 and MAX6651" + <device type>

<snip>

> +#include <linux/device.h>
> +#include <linux/mfd/core.h>
> +#include <linux/module.h>

I thought this driver was bool i.e. Y or N, not tristate?

<snip>

> +static struct mfd_cell max665x_devs[] = {
> +	{ .name = "max6651-gpio", },
> +	{ .name = "max6650", }, /* hwmon driver */

We really need to do something about this.

Guenter,
  once we've converted the hwmon part to a platform device, can we
  then safely rename it with "-hwmon" appended?

> +	{},
> +};
> +
> +static const struct regmap_config max665x_regmap_config = {
> +	.reg_bits = 8,
> +	.val_bits = 8,

This looks more sane, but it really should be tested.

> +static int max665x_probe(struct i2c_client *i2c,
> +			    const struct i2c_device_id *id)
> +{
> +	struct max665x_dev *max665x;
> +	int ret;
> +
> +	max665x = devm_kzalloc(&i2c->dev, sizeof(*max665x), GFP_KERNEL);
> +	if (!max665x)
> +		return -ENOMEM;
> +
> +	i2c_set_clientdata(i2c, max665x);
> +	max665x->dev = &i2c->dev;
> +	max665x->i2c = i2c;
> +	max665x->map = devm_regmap_init_i2c(i2c, &max665x_regmap_config);
> +	if (IS_ERR(max665x->map)) {
> +		ret = PTR_ERR(max665x->map);
> +		dev_err(max665x->dev, "Failed to allocate register map: %d\n",
> +			ret);
> +		return ret;
> +	}
> +
> +	mutex_init(&max665x->iolock);

*cough*

> +	ret = mfd_add_devices(max665x->dev, -1, max665x_devs,
> +			ARRAY_SIZE(max665x_devs),
> +			NULL, 0, NULL);
> +
> +	if (ret < 0)

Just 'if (ret)'

<snip>

> +static struct of_device_id max665x_dt_match[] = {
> +	{ .compatible = "maxim,max665x" },

  	{ .compatible = "maxim,max6650" },
  	{ .compatible = "maxim,max6651" },

> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, max665x_dt_match);

Module?

> +static struct i2c_driver max665x_driver = {
> +	.driver = {
> +		.name = "max665x",
> +		.owner = THIS_MODULE,
> +		.of_match_table = max665x_dt_match,

of_match_ptr()

> +	},
> +	.probe = max665x_probe,
> +	.remove = max665x_remove,
> +};
> +
> +module_i2c_driver(max665x_driver);

Module?

> +MODULE_AUTHOR("Laszlo Papp <laszlo.papp@polatis.com>");
> +MODULE_DESCRIPTION("MAX6650-MAX6651 MFD");

s/-/ and /

> +MODULE_LICENSE("GPL");

v1 or v2?

<snip>

> +#ifndef __LINUX_MFD_MAX665X_PRIVATE_H
> +#define __LINUX_MFD_MAX665X_PRIVATE_H
> +
> +#include <linux/i2c.h>
> +#include <linux/regmap.h>
> +
> +struct max665x_dev {
> +	struct device *dev;
> +	struct mutex iolock;

*Ah hem*

> +	struct i2c_client *i2c;
> +	struct regmap     *map;
> +	int type;

What's this used for?

> +};

> +#endif

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2014-02-14 11:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  9:15 [RFC PATCH 0/2] Redesign the MAX6650-6651 driver to be more flexible Laszlo Papp
2014-02-14  9:15 ` [PATCH 1/2] mfd: MAX6650/6651 support Laszlo Papp
2014-02-14 11:43   ` Lee Jones [this message]
2014-02-14 17:24   ` Guenter Roeck
2014-02-14  9:15 ` [PATCH 2/2] hwmon: (max6650) Convert to be a platform driver Laszlo Papp
2014-02-14 12:00   ` Lee Jones
2014-02-14 17:45   ` Guenter Roeck

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=20140214114349.GG9462@lee--X1 \
    --to=lee.jones@linaro.org \
    --cc=jdelvare@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.org \
    --cc=lpapp@kde.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

Powered by JetHome