linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
To: Cory Maccarrone <darkstar6262-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] [MISC] Add HTC PLD driver
Date: Mon, 7 Dec 2009 12:49:46 +0000	[thread overview]
Message-ID: <20091207124945.GA9018@sirena.org.uk> (raw)
In-Reply-To: <1260083683-13095-1-git-send-email-darkstar6262-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Sat, Dec 05, 2009 at 11:14:43PM -0800, Cory Maccarrone wrote:
> This change introduces a driver for the HTC PLD chip found
> on some smartphones, such as the HTC Wizard and HTC Herald.
> It works through the I2C bus and provides two main features:
> 
>   * 32 general-purpose I/O pins
>   * Input device support for directional keypad buttons
> 
> The above phones have LCD and keyboard backlight brightness
> and LED controls attached to this chip, as well as some
> power management functions.
> 
> This driver was originally written by
> Angelo Arrifano <miknix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> of the Linwizard project.

> Signed-off-by: Cory Maccarrone <darkstar6262-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

>  drivers/misc/Kconfig   |   11 +++
>  drivers/misc/Makefile  |    1 +
>  drivers/misc/htcpld.c  |  204 ++++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/htcpld.h |   14 ++++

A core in drivers/mfd plus drivers/gpio and drivers/input drivers for
the indidivudal functions would be a more natural implementation for
this.

> +void htcpld_chip_set(u8 chip_addr, u8 val)
> +{
> +	struct htcpld_chip_data *chip_data;
> +
> +	if (chip_addr > HTCPLD_ADDR_MAX)
> +		return;
> +
> +	if (!htcpld_chip[chip_addr])
> +		return;
> +
> +	chip_data = i2c_get_clientdata(htcpld_chip[chip_addr]);
> +	if (!chip_data)
> +		return;
> +
> +	i2c_smbus_read_byte_data(htcpld_chip[chip_addr],
> +				(chip_data->cache = val));
> +}
> +EXPORT_SYMBOL_GPL(htcpld_chip_set);

I'd certainly suggest taking a look at how MFD core drivers are usually
structured.  Much of this code looks like it's supposed to be doing the
same job as a MFD driver normally would but without the device model.

  parent reply	other threads:[~2009-12-07 12:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-06  7:14 [PATCH] [MISC] Add HTC PLD driver Cory Maccarrone
     [not found] ` <1260083683-13095-1-git-send-email-darkstar6262-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-12-07 12:49   ` Mark Brown [this message]
2009-12-07 13:13   ` Jean Delvare
     [not found]     ` <20091207141329.3dd3411c-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-12-12 21:02       ` Cory Maccarrone

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=20091207124945.GA9018@sirena.org.uk \
    --to=broonie-yzvpicuk2aatku/dhu1wvuem+bqzidxxqq4iyu8u01e@public.gmane.org \
    --cc=darkstar6262-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@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).