login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
August
»
29
Re: [PATCH] gpio: sx150x: correct and refine reset-on-probe behavior.
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: Jean Delvare
Subject:
Re: [PATCH] gpio: sx150x: correct and refine reset-on-probe behavior.
Date: Sunday, August 29, 2010 - 2:42 am
Hi Gregory, On Sat, 28 Aug 2010 10:15:52 -0700, Gregory Bean wrote:
quoted text
> Replace the arbitrary software-reset call from the device-probe > method, because: > - It is defective. To work correctly, it should be two byte writes, > not a single word write. As it stands, it does nothing. > - Some devices with sx150x expanders installed have their NRESET pins > ganged on the same line, so resetting one causes the others to reset - > not a nice thing to do arbitrarily! > - The probe, usually taking place at boot, implies a recent hard-reset, > so a software reset at this point is just a waste of energy anyway. > > Therefore, make it optional, defaulting to off, as this will match the > common case of probing at powerup and also matches the current > broken no-op behavior. > > Signed-off-by: Gregory Bean <gbean@codeaurora.org> > --- > drivers/gpio/sx150x.c | 29 ++++++++++++++++++++++++----- > include/linux/i2c/sx150x.h | 4 ++++ > 2 files changed, 28 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpio/sx150x.c b/drivers/gpio/sx150x.c > index b42f42c..6d68018 100644 > --- a/drivers/gpio/sx150x.c > +++ b/drivers/gpio/sx150x.c > @@ -459,17 +459,36 @@ static int sx150x_init_io(struct sx150x_chip *chip, u8 base, u16 cfg) > return err; > } > > -static int sx150x_init_hw(struct sx150x_chip *chip, > - struct sx150x_platform_data *pdata) > +static int sx150x_reset(struct sx150x_chip *chip) > { > - int err = 0; > + int err; > + > + err = i2c_smbus_write_byte_data(chip->client, > + chip->dev_cfg->reg_reset, > + 0x12); > + if (err < 0) > + return err; > > - err = i2c_smbus_write_word_data(chip->client, > + err = i2c_smbus_write_byte_data(chip->client, > chip->dev_cfg->reg_reset, > - 0x3412); > + 0x34); > if (err < 0) > return err; > > + return 0;
You might as well just "return err" in both cases.
quoted text
> +} > + > +static int sx150x_init_hw(struct sx150x_chip *chip, > + struct sx150x_platform_data *pdata) > +{ > + int err = 0; > + > + if (pdata->reset_during_probe) { > + err = sx150x_reset(chip); > + if (err < 0) > + return err; > + } > + > err = sx150x_i2c_write(chip->client, > chip->dev_cfg->reg_misc, > 0x01); > diff --git a/include/linux/i2c/sx150x.h b/include/linux/i2c/sx150x.h > index ee3049c..52baa79 100644 > --- a/include/linux/i2c/sx150x.h > +++ b/include/linux/i2c/sx150x.h > @@ -63,6 +63,9 @@ > * IRQ lines will appear. Similarly to gpio_base, the expander > * will create a block of irqs beginning at this number. > * This value is ignored if irq_summary is < 0. > + * @reset_during_probe: If set to true, the driver will trigger a full > + * reset of the chip at the beginning of the probe > + * in order to place it in a known state. > */ > struct sx150x_platform_data { > unsigned gpio_base; > @@ -73,6 +76,7 @@ struct sx150x_platform_data { > u16 io_polarity; > int irq_summary; > unsigned irq_base; > + bool reset_during_probe; > }; > > #endif /* __LINUX_I2C_SX150X_H */
-- Jean Delvare --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH] gpio: sx150x: correct and refine reset-on-probe be ...
, Gregory Bean
, (Sat Aug 28, 10:15 am)
Re: [PATCH] gpio: sx150x: correct and refine reset-on-prob ...
, Jean Delvare
, (Sun Aug 29, 2:42 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Paul Turner
[tg_shares_up rewrite v4 11/11] sched: update tg->shares after cpu.shares write
Mr. James W. Laferriere
Re: Linux 2.6.25-rc1 , syntax error near unexpected token `;'
Linus Torvalds
Linux 2.6.34-rc4
Colin Cross
[PATCH 12/21] ARM: tegra: Add suspend and hotplug support
Chuck Ebbert
Re: PCI: Unable to reserve mem region problem
git
:
Fredrik Kuivinen
Re: fatal: unable to create '.git/index': File exists
Wink Saville
How-to combine several separate git repos?
Emily Ren
How to pull remote branch with specified commit id?
Denis Bueno
Git clone error
pradeep singh
git-update-server-info may be required,cannot clone and pull from a remote reposit...
linux-netdev
:
Jamie Lokier
Re: POHMELFS high performance network filesystem. Transactions, failover, performa...
Timo Teräs
ip xfrm policy semantics
Jarek Poplawski
Re: socket api problem: can't bind an ipv6 socket to ::ffff:0.0.0.0
Michael S. Tsirkin
[PATCH 3/3] vhost: fix get_user_pages_fast error handling
Randy Macleod
RFC: TIPC API, bind to two networks
openbsd-misc
:
Sevan / Venture37
Re: This is what Linus Torvalds calls openBSD crowd
Netmaffia.hu
Tini Lányok AKCIÓBAN OTTHON
Siju George
This is what Linus Torvalds calls openBSD crowd
Darrin Chandler
Re: OT: Python (was Re: vi in /bin)
frantisek holop
Re: splassert: vwakeup: and friends
git-commits-head
:
Linux Kernel Mailing List
ASoC: fix registration of the SoC card in the Freescale MPC8610 drivers
Linux Kernel Mailing List
drivers/acpi: use kasprintf
Linux Kernel Mailing List
powerpc/fsl_msi: enable msi allocation in all banks
Linux Kernel Mailing List
bnx2x: Moving includes
Linux Kernel Mailing List
[ARM] mmp: add dma support to mmp2
Colocation donated by:
Syndicate