All of lore.kernel.org
 help / color / mirror / Atom feed
* Restricting USB access
From: Ryan Lawrie @ 2010-10-07 19:50 UTC (permalink / raw)
  To: linux-hotplug


Good afternoon,

Just wondering if I could get your assistance with something.

I need to secure the USB ports on my LAN workstations so they are not
writable by users (other than a certain group that I specify). Is this type
of restriction possible using udev rules?

I was using PolicyKit before but since we've changed OS (from openSUSE11.0
to 64-bit openSUSE11.2) that no longer seems to function properly.
Everybody has access to the USB ports now.

Any assistance you can offer would be greatly appreciated.

Take care,
Ryan Lawrie







^ permalink raw reply

* [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
From: Nishanth Menon @ 2010-10-07 19:50 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20101007185630.GA26435@n2100.arm.linux.org.uk>

Russell King - ARM Linux had written, on 10/07/2010 01:56 PM, the following:
> On Thu, Oct 07, 2010 at 07:17:08AM -0500, Menon, Nishanth wrote:
>>> -----Original Message-----
>>> From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
>>> owner at vger.kernel.org] On Behalf Of G, Manjunath Kondaiah
>>> Sent: Tuesday, September 21, 2010 5:01 AM
>>> To: linux-omap at vger.kernel.org
>>> Cc: linux-arm-kernel at lists.infradead.org; linux-mtd at lists.infradead.org
>>> Subject: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw
>>> read/write
>>>
>>> Following sparse warnings exists due to use of writel/w and readl/w
>>> functions.
>>>
>>> This patch fixes the sparse warnings by converting readl/w functions usage
>>> into
>>> __raw_readl/__raw_readw functions.
>> Apologies on bringing up an old topic here -> Is'nt it better to fix
>> readl/w or writel/w than replacing it with __raw_readl/w etc?
> 
> No.  If you're getting sparse warnings its because _you_ are using
> readl/writel wrongly.
> 
> They take a void __iomem pointer, not a u32, unsigned long, int, or
> even a void pointer.
void __iomem *p;
...

readl(p);

unrolls to:
({ u32 __v = ({ u32 __v = (( __u32)(__le32)(( __le32) ((void)0, 
*(volatile unsigned int *)((p))))); __v; }); __asm__ __volatile__ ("mcr 
p15,
, %0, c7, c10, 5" : : "r" (0) : "memory"); __v; });

({ u32 __v = ({ u32 __v

seems to be the obvious cause of sparse warnings such as that attempted 
to be fixed in [1]

  warning: symbol '__v' shadows an earlier one

my comment being that by moving {read,write}[wlb] to __raw versions dont 
solve the real issue of namespace here. fix should be in 
arch/arm/include/asm/io.h IMHO. so that there are no overlaps as this.

[1]http://marc.info/?l=linux-omap&m=128506333803725&w=2

-- 
Regards,
Nishanth Menon

^ permalink raw reply

* Re: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw read/write
From: Nishanth Menon @ 2010-10-07 19:50 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: G, Manjunath Kondaiah, linux-omap@vger.kernel.org,
	linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <20101007185630.GA26435@n2100.arm.linux.org.uk>

Russell King - ARM Linux had written, on 10/07/2010 01:56 PM, the following:
> On Thu, Oct 07, 2010 at 07:17:08AM -0500, Menon, Nishanth wrote:
>>> -----Original Message-----
>>> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
>>> owner@vger.kernel.org] On Behalf Of G, Manjunath Kondaiah
>>> Sent: Tuesday, September 21, 2010 5:01 AM
>>> To: linux-omap@vger.kernel.org
>>> Cc: linux-arm-kernel@lists.infradead.org; linux-mtd@lists.infradead.org
>>> Subject: [PATCH v2 09/10] OMAP2/3: Convert write/read functions to raw
>>> read/write
>>>
>>> Following sparse warnings exists due to use of writel/w and readl/w
>>> functions.
>>>
>>> This patch fixes the sparse warnings by converting readl/w functions usage
>>> into
>>> __raw_readl/__raw_readw functions.
>> Apologies on bringing up an old topic here -> Is'nt it better to fix
>> readl/w or writel/w than replacing it with __raw_readl/w etc?
> 
> No.  If you're getting sparse warnings its because _you_ are using
> readl/writel wrongly.
> 
> They take a void __iomem pointer, not a u32, unsigned long, int, or
> even a void pointer.
void __iomem *p;
...

readl(p);

unrolls to:
({ u32 __v = ({ u32 __v = (( __u32)(__le32)(( __le32) ((void)0, 
*(volatile unsigned int *)((p))))); __v; }); __asm__ __volatile__ ("mcr 
p15,
, %0, c7, c10, 5" : : "r" (0) : "memory"); __v; });

({ u32 __v = ({ u32 __v

seems to be the obvious cause of sparse warnings such as that attempted 
to be fixed in [1]

  warning: symbol '__v' shadows an earlier one

my comment being that by moving {read,write}[wlb] to __raw versions dont 
solve the real issue of namespace here. fix should be in 
arch/arm/include/asm/io.h IMHO. so that there are no overlaps as this.

[1]http://marc.info/?l=linux-omap&m=128506333803725&w=2

-- 
Regards,
Nishanth Menon

^ permalink raw reply

* Re: [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP
From: Thomas Petazzoni @ 2010-10-07 19:49 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
In-Reply-To: <1286363699-9614-8-git-send-email-svadivu@ti.com>

Hello Senthil,

I forgot one comment: in most Linux drivers, it is customary to put the
platform_driver definition just above the driver initialization
function, both of them at the end of the file. Of course, it's nothing
mandatory, but most of the drivers are organized this way, making it
easy for developers to find their way in all drivers.

So, in other words, this:

> +/* DISPC HW IP initialisation */
> +static int omap_dispchw_probe(struct platform_device *pdev)
> +{
> +	return 0;
> +}
> +
> +static int omap_dispchw_remove(struct platform_device *pdev)
> +{
> +	return 0;
> +}
> +
> +static struct platform_driver omap_dispchw_driver = {
> +	.probe          = omap_dispchw_probe,
> +	.remove         = omap_dispchw_remove,
> +	.driver         = {
> +		.name   = "dss_dispc",
> +		.owner  = THIS_MODULE,
> +	},
> +};

Should be just above this:

> +static int __init omap_dispc_init(void)
> +{
> +	return platform_driver_register(&omap_dispchw_driver);
> +}
> +
> +device_initcall(omap_dispc_init);

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* Re: [PATCH] serial: DCC(JTAG) serial and console emulation support
From: Mike Frysinger @ 2010-10-07 19:48 UTC (permalink / raw)
  To: Daniel Walker
  Cc: linux-kernel, Hyok S. Choi, Tony Lindgren, Jeff Ohlstein,
	Greg Kroah-Hartman, Ben Dooks, Alan Cox, Kukjin Kim, Feng Tang,
	Tobias Klauser, Jason Wessel, Philippe Langlais
In-Reply-To: <1286480364.23836.17.camel@c-dwalke-linux.qualcomm.com>

On Thu, Oct 7, 2010 at 15:39, Daniel Walker wrote:
> On Thu, 2010-10-07 at 15:25 -0400, Mike Frysinger wrote:
>> On Thu, Oct 7, 2010 at 14:36, Daniel Walker wrote:
>> > Many of JTAG debuggers for ARM support DCC protocol over JTAG
>> > connection, which is very useful to debug hardwares which has no
>> > serial port. This patch adds DCC serial emulation and the console
>> > support. System timer based polling method is used for the
>> > emulation of serial input interrupt handling.
>>
>> why use serial_core at all ?  seems like you could just use the tty
>> layer directly.  i did that with drivers/char/bfin_jtag_comm.c.
>>
>> although, there's the suggestion in the air that my jtag driver could
>> be converted to the HVC framework to even further simplify things.
>> but no one thinks it should be serial_core :).
>
> It will actually create a serial port on ttyS* if you want it to.. It
> could be debatable if that's useful, but I didn't rip that out because
> Hyok had that in his original code (he thought it was useful) ..

i dont think hijacking the "ttyS" namespace is acceptable, even if
it's behind a Kconfig.  other people have tried in the past (myself
included) and been shot down.  sounds like a shim for crappy userspace
apps that blindly assume /dev/ttyS*.  is that really an issue anymore
though now that things like /dev/ttyUSB* are so common and people are
used to picking between multiple serial sources ?
-mike

^ permalink raw reply

* [PATCH v2] mtd/nand.h: little more cleanup
From: Sebastian Andrzej Siewior @ 2010-10-07 19:48 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd, Wolfram Sang
In-Reply-To: <1286479829.1797.12.camel@brekeke>

- remove tabs between type and name.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
- replaced hipsize with chipsize.

 include/linux/mtd/nand.h |  315 +++++++++++++++++++++------------------------
 1 files changed, 147 insertions(+), 168 deletions(-)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index acd0b50..63e17d0 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -253,61 +253,62 @@ struct nand_chip;
 
 struct nand_onfi_params {
 	/* rev info and features block */
-	u8		sig[4]; /* 'O' 'N' 'F' 'I'  */
-	__le16		revision;
-	__le16		features;
-	__le16		opt_cmd;
-	u8		reserved[22];
+	/* 'O' 'N' 'F' 'I'  */
+	u8 sig[4];
+	__le16 revision;
+	__le16 features;
+	__le16 opt_cmd;
+	u8 reserved[22];
 
 	/* manufacturer information block */
-	char		manufacturer[12];
-	char		model[20];
-	u8		jedec_id;
-	__le16		date_code;
-	u8		reserved2[13];
+	char manufacturer[12];
+	char model[20];
+	u8 jedec_id;
+	__le16 date_code;
+	u8 reserved2[13];
 
 	/* memory organization block */
-	__le32		byte_per_page;
-	__le16		spare_bytes_per_page;
-	__le32		data_bytes_per_ppage;
-	__le16		spare_bytes_per_ppage;
-	__le32		pages_per_block;
-	__le32		blocks_per_lun;
-	u8		lun_count;
-	u8		addr_cycles;
-	u8		bits_per_cell;
-	__le16		bb_per_lun;
-	__le16		block_endurance;
-	u8		guaranteed_good_blocks;
-	__le16		guaranteed_block_endurance;
-	u8		programs_per_page;
-	u8		ppage_attr;
-	u8		ecc_bits;
-	u8		interleaved_bits;
-	u8		interleaved_ops;
-	u8		reserved3[13];
+	__le32 byte_per_page;
+	__le16 spare_bytes_per_page;
+	__le32 data_bytes_per_ppage;
+	__le16 spare_bytes_per_ppage;
+	__le32 pages_per_block;
+	__le32 blocks_per_lun;
+	u8 lun_count;
+	u8 addr_cycles;
+	u8 bits_per_cell;
+	__le16 bb_per_lun;
+	__le16 block_endurance;
+	u8 guaranteed_good_blocks;
+	__le16 guaranteed_block_endurance;
+	u8 programs_per_page;
+	u8 ppage_attr;
+	u8 ecc_bits;
+	u8 interleaved_bits;
+	u8 interleaved_ops;
+	u8 reserved3[13];
 
 	/* electrical parameter block */
-	u8		io_pin_capacitance_max;
-	__le16		async_timing_mode;
-	__le16		program_cache_timing_mode;
-	__le16		t_prog;
-	__le16		t_bers;
-	__le16		t_r;
-	__le16		t_ccs;
-	__le16		src_sync_timing_mode;
-	__le16		src_ssync_features;
-	__le16		clk_pin_capacitance_typ;
-	__le16		io_pin_capacitance_typ;
-	__le16		input_pin_capacitance_typ;
-	u8		input_pin_capacitance_max;
-	u8		driver_strenght_support;
-	__le16		t_int_r;
-	__le16		t_ald;
-	u8		reserved4[7];
+	u8 io_pin_capacitance_max;
+	__le16 async_timing_mode;
+	__le16 program_cache_timing_mode;
+	__le16 t_prog;
+	__le16 t_bers;
+	__le16 t_r;
+	__le16 t_ccs;
+	__le16 src_sync_timing_mode;
+	__le16 src_ssync_features;
+	__le16 clk_pin_capacitance_typ;
+	__le16 io_pin_capacitance_typ;
+	__le16 input_pin_capacitance_typ;
+	u8 input_pin_capacitance_max;
+	u8 driver_strenght_support;
+	__le16 t_int_r;
+	__le16 t_ald;
+	u8 reserved4[7];
 
 	/* vendor */
-	u8		reserved5[90];
+	u8 reserved5[90];
 
 	__le16 crc;
 } __attribute__((packed));
@@ -323,7 +324,7 @@ struct nand_onfi_params {
  *			when a hw controller is available.
  */
 struct nand_hw_control {
-	spinlock_t	 lock;
+	spinlock_t lock;
 	struct nand_chip *active;
 	wait_queue_head_t wq;
 };
@@ -353,44 +354,33 @@ struct nand_hw_control {
  * @write_oob:	function to write chip OOB data
  */
 struct nand_ecc_ctrl {
-	nand_ecc_modes_t	mode;
-	int			steps;
-	int			size;
-	int			bytes;
-	int			total;
-	int			prepad;
-	int			postpad;
+	nand_ecc_modes_t mode;
+	int steps;
+	int size;
+	int bytes;
+	int total;
+	int prepad;
+	int postpad;
 	struct nand_ecclayout	*layout;
-	void			(*hwctl)(struct mtd_info *mtd, int mode);
-	int			(*calculate)(struct mtd_info *mtd,
-					     const uint8_t *dat,
-					     uint8_t *ecc_code);
-	int			(*correct)(struct mtd_info *mtd, uint8_t *dat,
-					   uint8_t *read_ecc,
-					   uint8_t *calc_ecc);
-	int			(*read_page_raw)(struct mtd_info *mtd,
-						 struct nand_chip *chip,
-						 uint8_t *buf, int page);
-	void			(*write_page_raw)(struct mtd_info *mtd,
-						  struct nand_chip *chip,
-						  const uint8_t *buf);
-	int			(*read_page)(struct mtd_info *mtd,
-					     struct nand_chip *chip,
-					     uint8_t *buf, int page);
-	int			(*read_subpage)(struct mtd_info *mtd,
-					     struct nand_chip *chip,
-					     uint32_t offs, uint32_t len,
-					     uint8_t *buf);
-	void			(*write_page)(struct mtd_info *mtd,
-					      struct nand_chip *chip,
-					      const uint8_t *buf);
-	int			(*read_oob)(struct mtd_info *mtd,
-					    struct nand_chip *chip,
-					    int page,
-					    int sndcmd);
-	int			(*write_oob)(struct mtd_info *mtd,
-					     struct nand_chip *chip,
-					     int page);
+	void (*hwctl)(struct mtd_info *mtd, int mode);
+	int (*calculate)(struct mtd_info *mtd, const uint8_t *dat,
+			uint8_t *ecc_code);
+	int (*correct)(struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc,
+			uint8_t *calc_ecc);
+	int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
+			uint8_t *buf, int page);
+	void (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
+			const uint8_t *buf);
+	int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
+			uint8_t *buf, int page);
+	int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
+			uint32_t offs, uint32_t len, uint8_t *buf);
+	void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
+			const uint8_t *buf);
+	int (*read_oob)(struct mtd_info *mtd, struct nand_chip *chip, int page,
+			int sndcmd);
+	int (*write_oob)(struct mtd_info *mtd, struct nand_chip *chip,
+			int page);
 };
 
 /**
@@ -487,62 +477,55 @@ struct nand_buffers {
  */
 
 struct nand_chip {
-	void  __iomem	*IO_ADDR_R;
-	void  __iomem	*IO_ADDR_W;
-
-	uint8_t		(*read_byte)(struct mtd_info *mtd);
-	u16		(*read_word)(struct mtd_info *mtd);
-	void		(*write_buf)(struct mtd_info *mtd, const uint8_t *buf,
-			int len);
-	void		(*read_buf)(struct mtd_info *mtd, uint8_t *buf,
-			int len);
-	int		(*verify_buf)(struct mtd_info *mtd, const uint8_t *buf,
-			int len);
-	void		(*select_chip)(struct mtd_info *mtd, int chip);
-	int		(*block_bad)(struct mtd_info *mtd, loff_t ofs,
-			int getchip);
-	int		(*block_markbad)(struct mtd_info *mtd, loff_t ofs);
-	void		(*cmd_ctrl)(struct mtd_info *mtd, int dat,
-				    unsigned int ctrl);
-	int		(*init_size)(struct mtd_info *mtd,
-					struct nand_chip *this, u8 *id_data);
-	int		(*dev_ready)(struct mtd_info *mtd);
-	void		(*cmdfunc)(struct mtd_info *mtd, unsigned command,
-			int column, int page_addr);
-	int		(*waitfunc)(struct mtd_info *mtd,
-			struct nand_chip *this);
-	void		(*erase_cmd)(struct mtd_info *mtd, int page);
-	int		(*scan_bbt)(struct mtd_info *mtd);
-	int		(*errstat)(struct mtd_info *mtd, struct nand_chip *this,
-			int state, int status, int page);
-	int		(*write_page)(struct mtd_info *mtd,
-			struct nand_chip *chip, const uint8_t *buf, int page,
-			int cached, int raw);
-
-	int		chip_delay;
-	unsigned int	options;
-
-	int		page_shift;
-	int		phys_erase_shift;
-	int		bbt_erase_shift;
-	int		chip_shift;
-	int		numchips;
-	uint64_t	chipsize;
-	int		pagemask;
-	int		pagebuf;
-	int		subpagesize;
-	uint8_t		cellinfo;
-	int		badblockpos;
-	int		badblockbits;
-
-	int		onfi_version;
+	void __iomem *IO_ADDR_R;
+	void __iomem *IO_ADDR_W;
+
+	uint8_t (*read_byte)(struct mtd_info *mtd);
+	u16 (*read_word)(struct mtd_info *mtd);
+	void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
+	void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
+	int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
+	void (*select_chip)(struct mtd_info *mtd, int chip);
+	int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
+	int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
+	void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl);
+	int (*init_size)(struct mtd_info *mtd, struct nand_chip *this,
+			u8 *id_data);
+	int (*dev_ready)(struct mtd_info *mtd);
+	void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column,
+			int page_addr);
+	int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
+	void (*erase_cmd)(struct mtd_info *mtd, int page);
+	int (*scan_bbt)(struct mtd_info *mtd);
+	int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state,
+			int status, int page);
+	int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
+			const uint8_t *buf, int page, int cached, int raw);
+
+	int chip_delay;
+	unsigned int options;
+
+	int page_shift;
+	int phys_erase_shift;
+	int bbt_erase_shift;
+	int chip_shift;
+	int numchips;
+	uint64_t chipsize;
+	int pagemask;
+	int pagebuf;
+	int subpagesize;
+	uint8_t cellinfo;
+	int badblockpos;
+	int badblockbits;
+
+	int onfi_version;
 	struct nand_onfi_params	onfi_params;
 
-	flstate_t	state;
+	flstate_t state;
 
-	uint8_t		*oob_poi;
-	struct nand_hw_control  *controller;
-	struct nand_ecclayout	*ecclayout;
+	uint8_t *oob_poi;
+	struct nand_hw_control *controller;
+	struct nand_ecclayout *ecclayout;
 
 	struct nand_ecc_ctrl ecc;
 	struct nand_buffers *buffers;
@@ -550,13 +533,13 @@ struct nand_chip {
 
 	struct mtd_oob_ops ops;
 
-	uint8_t		*bbt;
-	struct nand_bbt_descr	*bbt_td;
-	struct nand_bbt_descr	*bbt_md;
+	uint8_t *bbt;
+	struct nand_bbt_descr *bbt_td;
+	struct nand_bbt_descr *bbt_md;
 
-	struct nand_bbt_descr	*badblock_pattern;
+	struct nand_bbt_descr *badblock_pattern;
 
-	void		*priv;
+	void *priv;
 };
 
 /*
@@ -629,17 +612,16 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
  * @priv:		hardware controller specific settings
  */
 struct platform_nand_chip {
-	int			nr_chips;
-	int			chip_offset;
-	int			nr_partitions;
-	struct mtd_partition	*partitions;
-	struct nand_ecclayout	*ecclayout;
-	int			chip_delay;
-	unsigned int		options;
-	const char		**part_probe_types;
-	void			(*set_parts)(uint64_t size,
-					struct platform_nand_chip *chip);
-	void			*priv;
+	int nr_chips;
+	int chip_offset;
+	int nr_partitions;
+	struct mtd_partition *partitions;
+	struct nand_ecclayout *ecclayout;
+	int chip_delay;
+	unsigned int options;
+	const char **part_probe_types;
+	void (*set_parts)(uint64_t size, struct platform_nand_chip *chip);
+	void *priv;
 };
 
 /* Keep gcc happy */
@@ -661,18 +643,15 @@ struct platform_device;
  * All fields are optional and depend on the hardware driver requirements
  */
 struct platform_nand_ctrl {
-	int		(*probe)(struct platform_device *pdev);
-	void		(*remove)(struct platform_device *pdev);
-	void		(*hwcontrol)(struct mtd_info *mtd, int cmd);
-	int		(*dev_ready)(struct mtd_info *mtd);
-	void		(*select_chip)(struct mtd_info *mtd, int chip);
-	void		(*cmd_ctrl)(struct mtd_info *mtd, int dat,
-				    unsigned int ctrl);
-	void		(*write_buf)(struct mtd_info *mtd,
-				    const uint8_t *buf, int len);
-	void		(*read_buf)(struct mtd_info *mtd,
-				    uint8_t *buf, int len);
-	void		*priv;
+	int (*probe)(struct platform_device *pdev);
+	void (*remove)(struct platform_device *pdev);
+	void (*hwcontrol)(struct mtd_info *mtd, int cmd);
+	int (*dev_ready)(struct mtd_info *mtd);
+	void (*select_chip)(struct mtd_info *mtd, int chip);
+	void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl);
+	void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
+	void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
+	void *priv;
 };
 
 /**
@@ -681,8 +660,8 @@ struct platform_nand_ctrl {
  * @ctrl:		controller level device structure
  */
 struct platform_nand_data {
-	struct platform_nand_chip	chip;
-	struct platform_nand_ctrl	ctrl;
+	struct platform_nand_chip chip;
+	struct platform_nand_ctrl ctrl;
 };
 
 /* Some helpers to access the data structures */
-- 
1.7.2.3

^ permalink raw reply related

* Re: [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC Move init,exit to driver
From: Thomas Petazzoni @ 2010-10-07 19:48 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
In-Reply-To: <1286363699-9614-13-git-send-email-svadivu@ti.com>

Hello Senthil,

On Wed,  6 Oct 2010 16:44:55 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

>  static struct {
> +	struct platform_device *pdev;
>  	void __iomem    *base;
>  
>  	u32	fifo_size[3];
> @@ -189,11 +190,22 @@ static inline u32 dispc_read_reg(const struct dispc_reg idx)
>  /* DISPC HW IP initialisation */
>  static int omap_dispchw_probe(struct platform_device *pdev)
>  {
> -	return 0;
> +	int r;
> +	dispc.pdev = pdev;
> +
> +	r = dispc_init();
> +	if (r) {
> +		DSSERR("Failed to initialize dispc\n");
> +		goto err_dispc;
> +	}
> +
> +err_dispc:
> +	return r;
>  }
>  
>  static int omap_dispchw_remove(struct platform_device *pdev)
>  {
> +	dispc_exit();
>  	return 0;
>  }

Same comments than the one for the patch on the RFBI driver.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* [PATCH v5] iio: light: Adding driver for ISL29018 ALS
From: rklein @ 2010-10-07 19:48 UTC (permalink / raw)
  To: greg
  Cc: jic23, joe, achew, olof, linux-i2c, linux-kernel, linux-iio,
	ldewangan, Rhyland Klein

From: Rhyland Klein <rklein@nvidia.com>

adding support for the ISL 29018 ambient light and proximity sensor.

Addressed comments from reviews by Jonathan Cameron and Joe Perches
  * Removed some excess dbg prints that only printed function name
  * Renamed some properties to make them more descriptive
  * Added a property to list available adc resolutions
  * Defined arrays for resolutions/ranges as static const
  * Change loops initialization to memset for extensibility.
    * used sizeof() instead of ARRAY_SIZE() to be safer
  * Added a property to list available adc ranges

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
---
 .../staging/iio/Documentation/sysfs-bus-iio-light  |   64 +++
 drivers/staging/iio/light/Kconfig                  |   12 +
 drivers/staging/iio/light/Makefile                 |    1 +
 drivers/staging/iio/light/isl29018.c               |  563 ++++++++++++++++++++
 4 files changed, 640 insertions(+), 0 deletions(-)
 create mode 100644 drivers/staging/iio/Documentation/sysfs-bus-iio-light
 create mode 100644 drivers/staging/iio/light/isl29018.c

diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-light b/drivers/staging/iio/Documentation/sysfs-bus-iio-light
new file mode 100644
index 0000000..5d84856
--- /dev/null
+++ b/drivers/staging/iio/Documentation/sysfs-bus-iio-light
@@ -0,0 +1,64 @@
+
+What:		/sys/bus/iio/devices/device[n]/range
+KernelVersion:	2.6.37
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Hardware dependent ADC Full Scale Range used for some ambient
+		light sensors in calculating lux.
+
+What:		/sys/bus/iio/devices/device[n]/range_available
+KernelVersion:	2.6.37
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Hardware dependent supported vales for ADC Full Scale Range.
+
+What:		/sys/bus/iio/devices/device[n]/adc_resolution
+KernelVersion:	2.6.37
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Hardware dependent ADC resolution of the ambient light sensor
+		used in calculating the lux.
+
+What:		/sys/bus/iio/devices/device[n]/adc_resolution_available
+KernelVersion:	2.6.37
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Hardware dependent list of possible values supported for the
+		adc_resolution of the given sensor.
+
+What:		/sys/bus/iio/devices/device[n]/illuminance0[_input|_raw]
+KernelVersion:	2.6.35
+Contact:	linux-iio@vger.kernel.org
+Description:
+		This should return the calculated lux from the light sensor. If
+		it comes back in SI units, it should also include _input else it
+		should include _raw to signify it is not in SI units.
+
+What:		/sys/.../device[n]/proximity_on_chip_ambient_infrared_supression
+KernelVersion:	2.6.37
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Hardware dependent mode for an ALS device to calculate the value
+		in proximity mode. When this is enabled, then the device should
+		use a infrared sensor reading to remove infrared noise from the
+		proximity reading. If this is not enabled, the driver can still
+		do this calculation manually by reading the infrared sensor
+		value and doing the negation in sw.
+
+What:		/sys/bus/iio/devices/device[n]/proximity[_input|_raw]
+KernelVersion:	2.6.37
+Contact:	linux-iio@vger.kernel.org
+Description:
+		This property is supported by proximity sensors and should be
+		used to return the value of a reading by the sensor. If this
+		value is returned in SI units, it should also include _input
+		but if it is not, then it should include _raw.
+
+What:		/sys/bus/iio/devices/device[n]/intensity_infrared[_input|_raw]
+KernelVersion:	2.6.37
+Contact:	linux-iio@vger.kernel.org
+Description:
+		This property is supported by sensors that have an infrared
+		sensing mode. This value should be the output from a reading
+		and if expressed in SI units, should include _input. If this
+		value is not in SI units, then it should include _raw.
diff --git a/drivers/staging/iio/light/Kconfig b/drivers/staging/iio/light/Kconfig
index 3ddc478..36d8bbe 100644
--- a/drivers/staging/iio/light/Kconfig
+++ b/drivers/staging/iio/light/Kconfig
@@ -12,3 +12,15 @@ config SENSORS_TSL2563
 
 	 This driver can also be built as a module.  If so, the module
 	 will be called tsl2563.
+
+config SENSORS_ISL29018
+        tristate "ISL 29018 light and proximity sensor"
+        depends on I2C
+        default n
+        help
+         If you say yes here you get support for ambient light sensing and
+         proximity infrared sensing from Intersil ISL29018.
+         This driver will provide the measurements of ambient light intensity
+         in lux, proximity infrared sensing and normal infrared sensing.
+         Data from sensor is accessible via sysfs.
+
diff --git a/drivers/staging/iio/light/Makefile b/drivers/staging/iio/light/Makefile
index 30f3300..9142c0e 100644
--- a/drivers/staging/iio/light/Makefile
+++ b/drivers/staging/iio/light/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_SENSORS_TSL2563)	+= tsl2563.o
+obj-$(CONFIG_SENSORS_ISL29018)	+= isl29018.o
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
new file mode 100644
index 0000000..c83f39f
--- /dev/null
+++ b/drivers/staging/iio/light/isl29018.c
@@ -0,0 +1,563 @@
+/*
+ * A iio driver for the light sensor ISL 29018.
+ *
+ * IIO driver for monitoring ambient light intensity in luxi, proximity
+ * sensing and infrared sensing.
+ *
+ * Copyright (c) 2010, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA	02110-1301, USA.
+ */
+
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/err.h>
+#include <linux/mutex.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include "../iio.h"
+
+#define CONVERSION_TIME_MS		100
+
+#define ISL29018_REG_ADD_COMMAND1	0x00
+#define COMMMAND1_OPMODE_SHIFT		5
+#define COMMMAND1_OPMODE_MASK		(7 << COMMMAND1_OPMODE_SHIFT)
+#define COMMMAND1_OPMODE_POWER_DOWN	0
+#define COMMMAND1_OPMODE_ALS_ONCE	1
+#define COMMMAND1_OPMODE_IR_ONCE	2
+#define COMMMAND1_OPMODE_PROX_ONCE	3
+
+#define ISL29018_REG_ADD_COMMANDII	0x01
+#define COMMANDII_RESOLUTION_SHIFT	2
+#define COMMANDII_RESOLUTION_MASK	(0x3 << COMMANDII_RESOLUTION_SHIFT)
+
+#define COMMANDII_RANGE_SHIFT		0
+#define COMMANDII_RANGE_MASK		(0x3 << COMMANDII_RANGE_SHIFT)
+
+#define COMMANDII_SCHEME_SHIFT		7
+#define COMMANDII_SCHEME_MASK		(0x1 << COMMANDII_SCHEME_SHIFT)
+
+#define ISL29018_REG_ADD_DATA_LSB	0x02
+#define ISL29018_REG_ADD_DATA_MSB	0x03
+#define ISL29018_MAX_REGS		ISL29018_REG_ADD_DATA_MSB
+
+struct isl29018_chip {
+	struct iio_dev		*indio_dev;
+	struct i2c_client	*client;
+	struct mutex		lock;
+	unsigned int		range;
+	unsigned int		adc_bit;
+	int			prox_scheme;
+	u8			reg_cache[ISL29018_MAX_REGS];
+};
+
+static int isl29018_write_data(struct i2c_client *client, u8 reg,
+			u8 val, u8 mask, u8 shift)
+{
+	u8 regval;
+	int ret = 0;
+	struct isl29018_chip *chip = i2c_get_clientdata(client);
+
+	regval = chip->reg_cache[reg];
+	regval &= ~mask;
+	regval |= val << shift;
+
+	ret = i2c_smbus_write_byte_data(client, reg, regval);
+	if (ret) {
+		dev_err(&client->dev, "Write to device fails status %x\n", ret);
+		return ret;
+	}
+	chip->reg_cache[reg] = regval;
+
+	return 0;
+}
+
+static int isl29018_set_range(struct i2c_client *client, unsigned long range,
+		unsigned int *new_range)
+{
+	static const unsigned long supp_ranges[] = {1000, 4000, 16000, 64000};
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(supp_ranges); ++i) {
+		if (range <= supp_ranges[i]) {
+			*new_range = (unsigned int)supp_ranges[i];
+			break;
+		}
+	}
+
+	if (i >= ARRAY_SIZE(supp_ranges))
+		return -EINVAL;
+
+	return isl29018_write_data(client, ISL29018_REG_ADD_COMMANDII,
+			i, COMMANDII_RANGE_MASK, COMMANDII_RANGE_SHIFT);
+}
+
+static int isl29018_set_resolution(struct i2c_client *client,
+			unsigned long adcbit, unsigned int *conf_adc_bit)
+{
+	static const unsigned long supp_adcbit[] = {16, 12, 8, 4};
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(supp_adcbit); ++i) {
+		if (adcbit >= supp_adcbit[i]) {
+			*conf_adc_bit = (unsigned int)supp_adcbit[i];
+			break;
+		}
+	}
+
+	if (i >= ARRAY_SIZE(supp_adcbit))
+		return -EINVAL;
+
+	return isl29018_write_data(client, ISL29018_REG_ADD_COMMANDII,
+			i, COMMANDII_RESOLUTION_MASK,
+			COMMANDII_RESOLUTION_SHIFT);
+}
+
+static int isl29018_read_sensor_input(struct i2c_client *client, int mode)
+{
+	int status;
+	int lsb;
+	int msb;
+
+	/* Set mode */
+	status = isl29018_write_data(client, ISL29018_REG_ADD_COMMAND1,
+			mode, COMMMAND1_OPMODE_MASK, COMMMAND1_OPMODE_SHIFT);
+	if (status) {
+		dev_err(&client->dev, "Error in setting operating mode\n");
+		return status;
+	}
+	msleep(CONVERSION_TIME_MS);
+	lsb = i2c_smbus_read_byte_data(client, ISL29018_REG_ADD_DATA_LSB);
+	if (lsb < 0) {
+		dev_err(&client->dev, "Error in reading LSB DATA\n");
+		return lsb;
+	}
+
+	msb = i2c_smbus_read_byte_data(client, ISL29018_REG_ADD_DATA_MSB);
+	if (msb < 0) {
+		dev_err(&client->dev, "Error in reading MSB DATA\n");
+		return msb;
+	}
+	dev_vdbg(&client->dev, "MSB 0x%x and LSB 0x%x\n", msb, lsb);
+
+	return (msb << 8) | lsb;
+}
+
+static int isl29018_read_lux(struct i2c_client *client, int *lux)
+{
+	int lux_data;
+	struct isl29018_chip *chip = i2c_get_clientdata(client);
+
+	lux_data = isl29018_read_sensor_input(client,
+				COMMMAND1_OPMODE_ALS_ONCE);
+
+	if (lux_data < 0)
+		return lux_data;
+
+	*lux = (lux_data * chip->range) >> chip->adc_bit;
+
+	return 0;
+}
+
+static int isl29018_read_ir(struct i2c_client *client, int *ir)
+{
+	int ir_data;
+
+	ir_data = isl29018_read_sensor_input(client, COMMMAND1_OPMODE_IR_ONCE);
+
+	if (ir_data < 0)
+		return ir_data;
+
+	*ir = ir_data;
+
+	return 0;
+}
+
+static int isl29018_read_proximity_ir(struct i2c_client *client, int scheme,
+		int *near_ir)
+{
+	int status;
+	int prox_data = -1;
+	int ir_data = -1;
+
+	/* Do proximity sensing with required scheme */
+	status = isl29018_write_data(client, ISL29018_REG_ADD_COMMANDII,
+			scheme, COMMANDII_SCHEME_MASK, COMMANDII_SCHEME_SHIFT);
+	if (status) {
+		dev_err(&client->dev, "Error in setting operating mode\n");
+		return status;
+	}
+
+	prox_data = isl29018_read_sensor_input(client,
+					COMMMAND1_OPMODE_PROX_ONCE);
+	if (prox_data < 0)
+		return prox_data;
+
+	if (scheme == 1) {
+		*near_ir = prox_data;
+		return 0;
+	}
+
+	ir_data = isl29018_read_sensor_input(client,
+				COMMMAND1_OPMODE_IR_ONCE);
+
+	if (ir_data < 0)
+		return ir_data;
+
+	if (prox_data >= ir_data)
+		*near_ir = prox_data - ir_data;
+	else
+		*near_ir = 0;
+
+	return 0;
+}
+
+static ssize_t get_sensor_data(struct device *dev, char *buf, int mode)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+	struct i2c_client *client = chip->client;
+	int value = 0;
+	int status;
+
+	mutex_lock(&chip->lock);
+	switch (mode) {
+	case COMMMAND1_OPMODE_PROX_ONCE:
+		status = isl29018_read_proximity_ir(client,
+				chip->prox_scheme, &value);
+		break;
+
+	case COMMMAND1_OPMODE_ALS_ONCE:
+		status = isl29018_read_lux(client, &value);
+		break;
+
+	case COMMMAND1_OPMODE_IR_ONCE:
+		status = isl29018_read_ir(client, &value);
+		break;
+
+	default:
+		dev_err(&client->dev, "Mode %d is not supported\n", mode);
+		mutex_unlock(&chip->lock);
+		return -EBUSY;
+	}
+	if (status < 0) {
+		dev_err(&client->dev, "Error in Reading data");
+		mutex_unlock(&chip->lock);
+		return status;
+	}
+
+	mutex_unlock(&chip->lock);
+
+	return sprintf(buf, "%d\n", value);
+}
+
+/* Sysfs interface */
+/* range */
+static ssize_t show_range(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+
+	return sprintf(buf, "%u\n", chip->range);
+}
+
+static ssize_t store_range(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+	struct i2c_client *client = chip->client;
+	int status;
+	unsigned long lval;
+	unsigned int new_range;
+
+	if (strict_strtoul(buf, 10, &lval))
+		return -EINVAL;
+
+	if (!(lval == 1000UL || lval == 4000UL ||
+			lval == 16000UL || lval == 64000UL)) {
+		dev_err(dev, "The range is not supported\n");
+		return -EINVAL;
+	}
+
+	mutex_lock(&chip->lock);
+	status = isl29018_set_range(client, lval, &new_range);
+	if (status < 0) {
+		mutex_unlock(&chip->lock);
+		dev_err(dev, "Error in setting max range\n");
+		return status;
+	}
+	chip->range = new_range;
+	mutex_unlock(&chip->lock);
+
+	return count;
+}
+
+/* resolution */
+static ssize_t show_resolution(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+
+	return sprintf(buf, "%u\n", chip->adc_bit);
+}
+
+static ssize_t store_resolution(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+	struct i2c_client *client = chip->client;
+	int status;
+	unsigned long lval;
+	unsigned int new_adc_bit;
+
+	if (strict_strtoul(buf, 10, &lval))
+		return -EINVAL;
+	if (!(lval == 4 || lval == 8 || lval == 12 || lval == 16)) {
+		dev_err(dev, "The resolution is not supported\n");
+		return -EINVAL;
+	}
+
+	mutex_lock(&chip->lock);
+	status = isl29018_set_resolution(client, lval, &new_adc_bit);
+	if (status < 0) {
+		mutex_unlock(&chip->lock);
+		dev_err(dev, "Error in setting resolution\n");
+		return status;
+	}
+	chip->adc_bit = new_adc_bit;
+	mutex_unlock(&chip->lock);
+
+	return count;
+}
+
+/* proximity scheme */
+static ssize_t show_prox_infrared_supression(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+
+	/* return the "proximity scheme" i.e. if the chip does on chip
+	infrared supression (1 means perform on chip supression) */
+	return sprintf(buf, "%d\n", chip->prox_scheme);
+}
+
+static ssize_t store_prox_infrared_supression(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+	unsigned long lval;
+
+	if (strict_strtoul(buf, 10, &lval))
+		return -EINVAL;
+	if (!(lval == 0UL || lval == 1UL)) {
+		dev_err(dev, "The mode is not supported\n");
+		return -EINVAL;
+	}
+
+	/* get the  "proximity scheme" i.e. if the chip does on chip
+	infrared supression (1 means perform on chip supression) */
+	mutex_lock(&chip->lock);
+	chip->prox_scheme = (int)lval;
+	mutex_unlock(&chip->lock);
+
+	return count;
+}
+
+/* Read lux */
+static ssize_t show_lux(struct device *dev,
+		struct device_attribute *devattr, char *buf)
+{
+	return get_sensor_data(dev, buf, COMMMAND1_OPMODE_ALS_ONCE);
+}
+
+/* Read ir */
+static ssize_t show_ir(struct device *dev,
+		struct device_attribute *devattr, char *buf)
+{
+	return get_sensor_data(dev, buf, COMMMAND1_OPMODE_IR_ONCE);
+}
+
+/* Read nearest ir */
+static ssize_t show_proxim_ir(struct device *dev,
+		struct device_attribute *devattr, char *buf)
+{
+	return get_sensor_data(dev, buf, COMMMAND1_OPMODE_PROX_ONCE);
+}
+
+/* Read name */
+static ssize_t show_name(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+
+	return sprintf(buf, "%s\n", chip->client->name);
+}
+
+static IIO_DEVICE_ATTR(range, S_IRUGO | S_IWUSR, show_range, store_range, 0);
+static IIO_CONST_ATTR(range_available, "1000 4000 16000 64000");
+static IIO_CONST_ATTR(adc_resolution_available, "4 8 12 16");
+static IIO_DEVICE_ATTR(adc_resolution, S_IRUGO | S_IWUSR,
+					show_resolution, store_resolution, 0);
+static IIO_DEVICE_ATTR(proximity_on_chip_ambient_infrared_supression,
+					S_IRUGO | S_IWUSR,
+					show_prox_infrared_suppression,
+					store_prox_infrared_supression, 0);
+static IIO_DEVICE_ATTR(illuminance0_input, S_IRUGO, show_lux, NULL, 0);
+static IIO_DEVICE_ATTR(intensity_infrared_raw, S_IRUGO, show_ir, NULL, 0);
+static IIO_DEVICE_ATTR(proximity_raw, S_IRUGO, show_proxim_ir, NULL, 0);
+static IIO_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
+
+#define ISL29018_DEV_ATTR(name) (&iio_dev_attr_##name.dev_attr.attr)
+static struct attribute *isl29018_attributes[] = {
+	ISL29018_DEV_ATTR(name),
+	ISL29018_DEV_ATTR(range),
+	ISL29018_DEV_ATTR(range_available),
+	ISL29018_DEV_ATTR(adc_resolution),
+	ISL29018_DEV_ATTR(adc_resolution_available),
+	ISL29018_DEV_ATTR(proximity_on_chip_ambient_infrared_supression),
+	ISL29018_DEV_ATTR(illuminance0_input),
+	ISL29018_DEV_ATTR(intensity_infrared_raw),
+	ISL29018_DEV_ATTR(proximity_raw),
+	NULL
+};
+
+static const struct attribute_group isl29108_group = {
+	.attrs = isl29018_attributes,
+};
+
+static int isl29018_chip_init(struct i2c_client *client)
+{
+	struct isl29018_chip *chip = i2c_get_clientdata(client);
+	int status;
+	int i;
+	int new_adc_bit;
+	unsigned int new_range;
+
+	memset(chip->reg_cache, 0, sizeof(chip->reg_cache));
+
+	/* set defaults */
+	status = isl29018_set_range(client, chip->range, &new_range);
+	if (status < 0) {
+		dev_err(&client->dev, "Init of isl29018 fails\n");
+		return status;
+	}
+
+	status = isl29018_set_resolution(client, chip->adc_bit,
+						&new_adc_bit);
+
+	return 0;
+}
+
+static int __devinit isl29018_probe(struct i2c_client *client,
+			 const struct i2c_device_id *id)
+{
+	struct isl29018_chip *chip;
+	int err;
+
+	chip = kzalloc(sizeof(struct isl29018_chip), GFP_KERNEL);
+	if (!chip) {
+		dev_err(&client->dev, "Memory allocation fails\n");
+		err = -ENOMEM;
+		goto exit;
+	}
+
+	i2c_set_clientdata(client, chip);
+	chip->client = client;
+
+	mutex_init(&chip->lock);
+
+	chip->range = 1000;
+	chip->adc_bit = 16;
+
+	err = isl29018_chip_init(client);
+	if (err)
+		goto exit_free;
+
+	chip->indio_dev = iio_allocate_device();
+	if (!chip->indio_dev) {
+		dev_err(&client->dev, "iio allocation fails\n");
+		goto exit_free;
+	}
+	chip->indio_dev->attrs = &isl29108_group;
+	chip->indio_dev->dev.parent = &client->dev;
+	chip->indio_dev->dev_data = (void *)(chip);
+	chip->indio_dev->driver_module = THIS_MODULE;
+	chip->indio_dev->modes = INDIO_DIRECT_MODE;
+	err = iio_device_register(chip->indio_dev);
+	if (err) {
+		dev_err(&client->dev, "iio registration fails\n");
+		goto exit_iio_free;
+	}
+
+	return 0;
+exit_iio_free:
+	iio_free_device(chip->indio_dev);
+exit_free:
+	kfree(chip);
+exit:
+	return err;
+}
+
+static int __devexit isl29018_remove(struct i2c_client *client)
+{
+	struct isl29018_chip *chip = i2c_get_clientdata(client);
+
+	dev_dbg(&client->dev, "%s()\n", __func__);
+	iio_device_unregister(chip->indio_dev);
+	kfree(chip);
+
+	return 0;
+}
+
+static const struct i2c_device_id isl29018_id[] = {
+	{"isl29018", 0},
+	{}
+};
+
+MODULE_DEVICE_TABLE(i2c, isl29018_id);
+
+static struct i2c_driver isl29018_driver = {
+	.class	= I2C_CLASS_HWMON,
+	.driver	 = {
+			.name = "isl29018",
+			.owner = THIS_MODULE,
+		    },
+	.probe	 = isl29018_probe,
+	.remove	 = __devexit_p(isl29018_remove),
+	.id_table = isl29018_id,
+};
+
+static int __init isl29018_init(void)
+{
+	return i2c_add_driver(&isl29018_driver);
+}
+
+static void __exit isl29018_exit(void)
+{
+	i2c_del_driver(&isl29018_driver);
+}
+
+module_init(isl29018_init);
+module_exit(isl29018_exit);
+
+MODULE_DESCRIPTION("ISL29018 Ambient Light Sensor driver");
+MODULE_LICENSE("GPL");
-- 
1.7.0.4

^ permalink raw reply related

* [PATCH v5] iio: light: Adding driver for ISL29018 ALS
From: rklein-DDmLM1+adcrQT0dZR+AlfA @ 2010-10-07 19:48 UTC (permalink / raw)
  To: greg-U8xfFu+wG4EAvxtiuMwx3w
  Cc: jic23-KWPb1pKIrIJaa/9Udqfwiw, joe-6d6DIl74uiNBDgjK7y7TUQ,
	achew-DDmLM1+adcrQT0dZR+AlfA, olof-nZhT3qVonbNeoWH0uzbU5w,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-iio-u79uwXL29TY76Z2rM5mHXA,
	ldewangan-DDmLM1+adcrQT0dZR+AlfA, Rhyland Klein

From: Rhyland Klein <rklein-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

adding support for the ISL 29018 ambient light and proximity sensor.

Addressed comments from reviews by Jonathan Cameron and Joe Perches
  * Removed some excess dbg prints that only printed function name
  * Renamed some properties to make them more descriptive
  * Added a property to list available adc resolutions
  * Defined arrays for resolutions/ranges as static const
  * Change loops initialization to memset for extensibility.
    * used sizeof() instead of ARRAY_SIZE() to be safer
  * Added a property to list available adc ranges

Signed-off-by: Rhyland Klein <rklein-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
---
 .../staging/iio/Documentation/sysfs-bus-iio-light  |   64 +++
 drivers/staging/iio/light/Kconfig                  |   12 +
 drivers/staging/iio/light/Makefile                 |    1 +
 drivers/staging/iio/light/isl29018.c               |  563 ++++++++++++++++++++
 4 files changed, 640 insertions(+), 0 deletions(-)
 create mode 100644 drivers/staging/iio/Documentation/sysfs-bus-iio-light
 create mode 100644 drivers/staging/iio/light/isl29018.c

diff --git a/drivers/staging/iio/Documentation/sysfs-bus-iio-light b/drivers/staging/iio/Documentation/sysfs-bus-iio-light
new file mode 100644
index 0000000..5d84856
--- /dev/null
+++ b/drivers/staging/iio/Documentation/sysfs-bus-iio-light
@@ -0,0 +1,64 @@
+
+What:		/sys/bus/iio/devices/device[n]/range
+KernelVersion:	2.6.37
+Contact:	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
+Description:
+		Hardware dependent ADC Full Scale Range used for some ambient
+		light sensors in calculating lux.
+
+What:		/sys/bus/iio/devices/device[n]/range_available
+KernelVersion:	2.6.37
+Contact:	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
+Description:
+		Hardware dependent supported vales for ADC Full Scale Range.
+
+What:		/sys/bus/iio/devices/device[n]/adc_resolution
+KernelVersion:	2.6.37
+Contact:	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
+Description:
+		Hardware dependent ADC resolution of the ambient light sensor
+		used in calculating the lux.
+
+What:		/sys/bus/iio/devices/device[n]/adc_resolution_available
+KernelVersion:	2.6.37
+Contact:	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
+Description:
+		Hardware dependent list of possible values supported for the
+		adc_resolution of the given sensor.
+
+What:		/sys/bus/iio/devices/device[n]/illuminance0[_input|_raw]
+KernelVersion:	2.6.35
+Contact:	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
+Description:
+		This should return the calculated lux from the light sensor. If
+		it comes back in SI units, it should also include _input else it
+		should include _raw to signify it is not in SI units.
+
+What:		/sys/.../device[n]/proximity_on_chip_ambient_infrared_supression
+KernelVersion:	2.6.37
+Contact:	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
+Description:
+		Hardware dependent mode for an ALS device to calculate the value
+		in proximity mode. When this is enabled, then the device should
+		use a infrared sensor reading to remove infrared noise from the
+		proximity reading. If this is not enabled, the driver can still
+		do this calculation manually by reading the infrared sensor
+		value and doing the negation in sw.
+
+What:		/sys/bus/iio/devices/device[n]/proximity[_input|_raw]
+KernelVersion:	2.6.37
+Contact:	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
+Description:
+		This property is supported by proximity sensors and should be
+		used to return the value of a reading by the sensor. If this
+		value is returned in SI units, it should also include _input
+		but if it is not, then it should include _raw.
+
+What:		/sys/bus/iio/devices/device[n]/intensity_infrared[_input|_raw]
+KernelVersion:	2.6.37
+Contact:	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
+Description:
+		This property is supported by sensors that have an infrared
+		sensing mode. This value should be the output from a reading
+		and if expressed in SI units, should include _input. If this
+		value is not in SI units, then it should include _raw.
diff --git a/drivers/staging/iio/light/Kconfig b/drivers/staging/iio/light/Kconfig
index 3ddc478..36d8bbe 100644
--- a/drivers/staging/iio/light/Kconfig
+++ b/drivers/staging/iio/light/Kconfig
@@ -12,3 +12,15 @@ config SENSORS_TSL2563
 
 	 This driver can also be built as a module.  If so, the module
 	 will be called tsl2563.
+
+config SENSORS_ISL29018
+        tristate "ISL 29018 light and proximity sensor"
+        depends on I2C
+        default n
+        help
+         If you say yes here you get support for ambient light sensing and
+         proximity infrared sensing from Intersil ISL29018.
+         This driver will provide the measurements of ambient light intensity
+         in lux, proximity infrared sensing and normal infrared sensing.
+         Data from sensor is accessible via sysfs.
+
diff --git a/drivers/staging/iio/light/Makefile b/drivers/staging/iio/light/Makefile
index 30f3300..9142c0e 100644
--- a/drivers/staging/iio/light/Makefile
+++ b/drivers/staging/iio/light/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_SENSORS_TSL2563)	+= tsl2563.o
+obj-$(CONFIG_SENSORS_ISL29018)	+= isl29018.o
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
new file mode 100644
index 0000000..c83f39f
--- /dev/null
+++ b/drivers/staging/iio/light/isl29018.c
@@ -0,0 +1,563 @@
+/*
+ * A iio driver for the light sensor ISL 29018.
+ *
+ * IIO driver for monitoring ambient light intensity in luxi, proximity
+ * sensing and infrared sensing.
+ *
+ * Copyright (c) 2010, NVIDIA Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA	02110-1301, USA.
+ */
+
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/err.h>
+#include <linux/mutex.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include "../iio.h"
+
+#define CONVERSION_TIME_MS		100
+
+#define ISL29018_REG_ADD_COMMAND1	0x00
+#define COMMMAND1_OPMODE_SHIFT		5
+#define COMMMAND1_OPMODE_MASK		(7 << COMMMAND1_OPMODE_SHIFT)
+#define COMMMAND1_OPMODE_POWER_DOWN	0
+#define COMMMAND1_OPMODE_ALS_ONCE	1
+#define COMMMAND1_OPMODE_IR_ONCE	2
+#define COMMMAND1_OPMODE_PROX_ONCE	3
+
+#define ISL29018_REG_ADD_COMMANDII	0x01
+#define COMMANDII_RESOLUTION_SHIFT	2
+#define COMMANDII_RESOLUTION_MASK	(0x3 << COMMANDII_RESOLUTION_SHIFT)
+
+#define COMMANDII_RANGE_SHIFT		0
+#define COMMANDII_RANGE_MASK		(0x3 << COMMANDII_RANGE_SHIFT)
+
+#define COMMANDII_SCHEME_SHIFT		7
+#define COMMANDII_SCHEME_MASK		(0x1 << COMMANDII_SCHEME_SHIFT)
+
+#define ISL29018_REG_ADD_DATA_LSB	0x02
+#define ISL29018_REG_ADD_DATA_MSB	0x03
+#define ISL29018_MAX_REGS		ISL29018_REG_ADD_DATA_MSB
+
+struct isl29018_chip {
+	struct iio_dev		*indio_dev;
+	struct i2c_client	*client;
+	struct mutex		lock;
+	unsigned int		range;
+	unsigned int		adc_bit;
+	int			prox_scheme;
+	u8			reg_cache[ISL29018_MAX_REGS];
+};
+
+static int isl29018_write_data(struct i2c_client *client, u8 reg,
+			u8 val, u8 mask, u8 shift)
+{
+	u8 regval;
+	int ret = 0;
+	struct isl29018_chip *chip = i2c_get_clientdata(client);
+
+	regval = chip->reg_cache[reg];
+	regval &= ~mask;
+	regval |= val << shift;
+
+	ret = i2c_smbus_write_byte_data(client, reg, regval);
+	if (ret) {
+		dev_err(&client->dev, "Write to device fails status %x\n", ret);
+		return ret;
+	}
+	chip->reg_cache[reg] = regval;
+
+	return 0;
+}
+
+static int isl29018_set_range(struct i2c_client *client, unsigned long range,
+		unsigned int *new_range)
+{
+	static const unsigned long supp_ranges[] = {1000, 4000, 16000, 64000};
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(supp_ranges); ++i) {
+		if (range <= supp_ranges[i]) {
+			*new_range = (unsigned int)supp_ranges[i];
+			break;
+		}
+	}
+
+	if (i >= ARRAY_SIZE(supp_ranges))
+		return -EINVAL;
+
+	return isl29018_write_data(client, ISL29018_REG_ADD_COMMANDII,
+			i, COMMANDII_RANGE_MASK, COMMANDII_RANGE_SHIFT);
+}
+
+static int isl29018_set_resolution(struct i2c_client *client,
+			unsigned long adcbit, unsigned int *conf_adc_bit)
+{
+	static const unsigned long supp_adcbit[] = {16, 12, 8, 4};
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(supp_adcbit); ++i) {
+		if (adcbit >= supp_adcbit[i]) {
+			*conf_adc_bit = (unsigned int)supp_adcbit[i];
+			break;
+		}
+	}
+
+	if (i >= ARRAY_SIZE(supp_adcbit))
+		return -EINVAL;
+
+	return isl29018_write_data(client, ISL29018_REG_ADD_COMMANDII,
+			i, COMMANDII_RESOLUTION_MASK,
+			COMMANDII_RESOLUTION_SHIFT);
+}
+
+static int isl29018_read_sensor_input(struct i2c_client *client, int mode)
+{
+	int status;
+	int lsb;
+	int msb;
+
+	/* Set mode */
+	status = isl29018_write_data(client, ISL29018_REG_ADD_COMMAND1,
+			mode, COMMMAND1_OPMODE_MASK, COMMMAND1_OPMODE_SHIFT);
+	if (status) {
+		dev_err(&client->dev, "Error in setting operating mode\n");
+		return status;
+	}
+	msleep(CONVERSION_TIME_MS);
+	lsb = i2c_smbus_read_byte_data(client, ISL29018_REG_ADD_DATA_LSB);
+	if (lsb < 0) {
+		dev_err(&client->dev, "Error in reading LSB DATA\n");
+		return lsb;
+	}
+
+	msb = i2c_smbus_read_byte_data(client, ISL29018_REG_ADD_DATA_MSB);
+	if (msb < 0) {
+		dev_err(&client->dev, "Error in reading MSB DATA\n");
+		return msb;
+	}
+	dev_vdbg(&client->dev, "MSB 0x%x and LSB 0x%x\n", msb, lsb);
+
+	return (msb << 8) | lsb;
+}
+
+static int isl29018_read_lux(struct i2c_client *client, int *lux)
+{
+	int lux_data;
+	struct isl29018_chip *chip = i2c_get_clientdata(client);
+
+	lux_data = isl29018_read_sensor_input(client,
+				COMMMAND1_OPMODE_ALS_ONCE);
+
+	if (lux_data < 0)
+		return lux_data;
+
+	*lux = (lux_data * chip->range) >> chip->adc_bit;
+
+	return 0;
+}
+
+static int isl29018_read_ir(struct i2c_client *client, int *ir)
+{
+	int ir_data;
+
+	ir_data = isl29018_read_sensor_input(client, COMMMAND1_OPMODE_IR_ONCE);
+
+	if (ir_data < 0)
+		return ir_data;
+
+	*ir = ir_data;
+
+	return 0;
+}
+
+static int isl29018_read_proximity_ir(struct i2c_client *client, int scheme,
+		int *near_ir)
+{
+	int status;
+	int prox_data = -1;
+	int ir_data = -1;
+
+	/* Do proximity sensing with required scheme */
+	status = isl29018_write_data(client, ISL29018_REG_ADD_COMMANDII,
+			scheme, COMMANDII_SCHEME_MASK, COMMANDII_SCHEME_SHIFT);
+	if (status) {
+		dev_err(&client->dev, "Error in setting operating mode\n");
+		return status;
+	}
+
+	prox_data = isl29018_read_sensor_input(client,
+					COMMMAND1_OPMODE_PROX_ONCE);
+	if (prox_data < 0)
+		return prox_data;
+
+	if (scheme == 1) {
+		*near_ir = prox_data;
+		return 0;
+	}
+
+	ir_data = isl29018_read_sensor_input(client,
+				COMMMAND1_OPMODE_IR_ONCE);
+
+	if (ir_data < 0)
+		return ir_data;
+
+	if (prox_data >= ir_data)
+		*near_ir = prox_data - ir_data;
+	else
+		*near_ir = 0;
+
+	return 0;
+}
+
+static ssize_t get_sensor_data(struct device *dev, char *buf, int mode)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+	struct i2c_client *client = chip->client;
+	int value = 0;
+	int status;
+
+	mutex_lock(&chip->lock);
+	switch (mode) {
+	case COMMMAND1_OPMODE_PROX_ONCE:
+		status = isl29018_read_proximity_ir(client,
+				chip->prox_scheme, &value);
+		break;
+
+	case COMMMAND1_OPMODE_ALS_ONCE:
+		status = isl29018_read_lux(client, &value);
+		break;
+
+	case COMMMAND1_OPMODE_IR_ONCE:
+		status = isl29018_read_ir(client, &value);
+		break;
+
+	default:
+		dev_err(&client->dev, "Mode %d is not supported\n", mode);
+		mutex_unlock(&chip->lock);
+		return -EBUSY;
+	}
+	if (status < 0) {
+		dev_err(&client->dev, "Error in Reading data");
+		mutex_unlock(&chip->lock);
+		return status;
+	}
+
+	mutex_unlock(&chip->lock);
+
+	return sprintf(buf, "%d\n", value);
+}
+
+/* Sysfs interface */
+/* range */
+static ssize_t show_range(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+
+	return sprintf(buf, "%u\n", chip->range);
+}
+
+static ssize_t store_range(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+	struct i2c_client *client = chip->client;
+	int status;
+	unsigned long lval;
+	unsigned int new_range;
+
+	if (strict_strtoul(buf, 10, &lval))
+		return -EINVAL;
+
+	if (!(lval == 1000UL || lval == 4000UL ||
+			lval == 16000UL || lval == 64000UL)) {
+		dev_err(dev, "The range is not supported\n");
+		return -EINVAL;
+	}
+
+	mutex_lock(&chip->lock);
+	status = isl29018_set_range(client, lval, &new_range);
+	if (status < 0) {
+		mutex_unlock(&chip->lock);
+		dev_err(dev, "Error in setting max range\n");
+		return status;
+	}
+	chip->range = new_range;
+	mutex_unlock(&chip->lock);
+
+	return count;
+}
+
+/* resolution */
+static ssize_t show_resolution(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+
+	return sprintf(buf, "%u\n", chip->adc_bit);
+}
+
+static ssize_t store_resolution(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+	struct i2c_client *client = chip->client;
+	int status;
+	unsigned long lval;
+	unsigned int new_adc_bit;
+
+	if (strict_strtoul(buf, 10, &lval))
+		return -EINVAL;
+	if (!(lval == 4 || lval == 8 || lval == 12 || lval == 16)) {
+		dev_err(dev, "The resolution is not supported\n");
+		return -EINVAL;
+	}
+
+	mutex_lock(&chip->lock);
+	status = isl29018_set_resolution(client, lval, &new_adc_bit);
+	if (status < 0) {
+		mutex_unlock(&chip->lock);
+		dev_err(dev, "Error in setting resolution\n");
+		return status;
+	}
+	chip->adc_bit = new_adc_bit;
+	mutex_unlock(&chip->lock);
+
+	return count;
+}
+
+/* proximity scheme */
+static ssize_t show_prox_infrared_supression(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+
+	/* return the "proximity scheme" i.e. if the chip does on chip
+	infrared supression (1 means perform on chip supression) */
+	return sprintf(buf, "%d\n", chip->prox_scheme);
+}
+
+static ssize_t store_prox_infrared_supression(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+	unsigned long lval;
+
+	if (strict_strtoul(buf, 10, &lval))
+		return -EINVAL;
+	if (!(lval == 0UL || lval == 1UL)) {
+		dev_err(dev, "The mode is not supported\n");
+		return -EINVAL;
+	}
+
+	/* get the  "proximity scheme" i.e. if the chip does on chip
+	infrared supression (1 means perform on chip supression) */
+	mutex_lock(&chip->lock);
+	chip->prox_scheme = (int)lval;
+	mutex_unlock(&chip->lock);
+
+	return count;
+}
+
+/* Read lux */
+static ssize_t show_lux(struct device *dev,
+		struct device_attribute *devattr, char *buf)
+{
+	return get_sensor_data(dev, buf, COMMMAND1_OPMODE_ALS_ONCE);
+}
+
+/* Read ir */
+static ssize_t show_ir(struct device *dev,
+		struct device_attribute *devattr, char *buf)
+{
+	return get_sensor_data(dev, buf, COMMMAND1_OPMODE_IR_ONCE);
+}
+
+/* Read nearest ir */
+static ssize_t show_proxim_ir(struct device *dev,
+		struct device_attribute *devattr, char *buf)
+{
+	return get_sensor_data(dev, buf, COMMMAND1_OPMODE_PROX_ONCE);
+}
+
+/* Read name */
+static ssize_t show_name(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct isl29018_chip *chip = indio_dev->dev_data;
+
+	return sprintf(buf, "%s\n", chip->client->name);
+}
+
+static IIO_DEVICE_ATTR(range, S_IRUGO | S_IWUSR, show_range, store_range, 0);
+static IIO_CONST_ATTR(range_available, "1000 4000 16000 64000");
+static IIO_CONST_ATTR(adc_resolution_available, "4 8 12 16");
+static IIO_DEVICE_ATTR(adc_resolution, S_IRUGO | S_IWUSR,
+					show_resolution, store_resolution, 0);
+static IIO_DEVICE_ATTR(proximity_on_chip_ambient_infrared_supression,
+					S_IRUGO | S_IWUSR,
+					show_prox_infrared_suppression,
+					store_prox_infrared_supression, 0);
+static IIO_DEVICE_ATTR(illuminance0_input, S_IRUGO, show_lux, NULL, 0);
+static IIO_DEVICE_ATTR(intensity_infrared_raw, S_IRUGO, show_ir, NULL, 0);
+static IIO_DEVICE_ATTR(proximity_raw, S_IRUGO, show_proxim_ir, NULL, 0);
+static IIO_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
+
+#define ISL29018_DEV_ATTR(name) (&iio_dev_attr_##name.dev_attr.attr)
+static struct attribute *isl29018_attributes[] = {
+	ISL29018_DEV_ATTR(name),
+	ISL29018_DEV_ATTR(range),
+	ISL29018_DEV_ATTR(range_available),
+	ISL29018_DEV_ATTR(adc_resolution),
+	ISL29018_DEV_ATTR(adc_resolution_available),
+	ISL29018_DEV_ATTR(proximity_on_chip_ambient_infrared_supression),
+	ISL29018_DEV_ATTR(illuminance0_input),
+	ISL29018_DEV_ATTR(intensity_infrared_raw),
+	ISL29018_DEV_ATTR(proximity_raw),
+	NULL
+};
+
+static const struct attribute_group isl29108_group = {
+	.attrs = isl29018_attributes,
+};
+
+static int isl29018_chip_init(struct i2c_client *client)
+{
+	struct isl29018_chip *chip = i2c_get_clientdata(client);
+	int status;
+	int i;
+	int new_adc_bit;
+	unsigned int new_range;
+
+	memset(chip->reg_cache, 0, sizeof(chip->reg_cache));
+
+	/* set defaults */
+	status = isl29018_set_range(client, chip->range, &new_range);
+	if (status < 0) {
+		dev_err(&client->dev, "Init of isl29018 fails\n");
+		return status;
+	}
+
+	status = isl29018_set_resolution(client, chip->adc_bit,
+						&new_adc_bit);
+
+	return 0;
+}
+
+static int __devinit isl29018_probe(struct i2c_client *client,
+			 const struct i2c_device_id *id)
+{
+	struct isl29018_chip *chip;
+	int err;
+
+	chip = kzalloc(sizeof(struct isl29018_chip), GFP_KERNEL);
+	if (!chip) {
+		dev_err(&client->dev, "Memory allocation fails\n");
+		err = -ENOMEM;
+		goto exit;
+	}
+
+	i2c_set_clientdata(client, chip);
+	chip->client = client;
+
+	mutex_init(&chip->lock);
+
+	chip->range = 1000;
+	chip->adc_bit = 16;
+
+	err = isl29018_chip_init(client);
+	if (err)
+		goto exit_free;
+
+	chip->indio_dev = iio_allocate_device();
+	if (!chip->indio_dev) {
+		dev_err(&client->dev, "iio allocation fails\n");
+		goto exit_free;
+	}
+	chip->indio_dev->attrs = &isl29108_group;
+	chip->indio_dev->dev.parent = &client->dev;
+	chip->indio_dev->dev_data = (void *)(chip);
+	chip->indio_dev->driver_module = THIS_MODULE;
+	chip->indio_dev->modes = INDIO_DIRECT_MODE;
+	err = iio_device_register(chip->indio_dev);
+	if (err) {
+		dev_err(&client->dev, "iio registration fails\n");
+		goto exit_iio_free;
+	}
+
+	return 0;
+exit_iio_free:
+	iio_free_device(chip->indio_dev);
+exit_free:
+	kfree(chip);
+exit:
+	return err;
+}
+
+static int __devexit isl29018_remove(struct i2c_client *client)
+{
+	struct isl29018_chip *chip = i2c_get_clientdata(client);
+
+	dev_dbg(&client->dev, "%s()\n", __func__);
+	iio_device_unregister(chip->indio_dev);
+	kfree(chip);
+
+	return 0;
+}
+
+static const struct i2c_device_id isl29018_id[] = {
+	{"isl29018", 0},
+	{}
+};
+
+MODULE_DEVICE_TABLE(i2c, isl29018_id);
+
+static struct i2c_driver isl29018_driver = {
+	.class	= I2C_CLASS_HWMON,
+	.driver	 = {
+			.name = "isl29018",
+			.owner = THIS_MODULE,
+		    },
+	.probe	 = isl29018_probe,
+	.remove	 = __devexit_p(isl29018_remove),
+	.id_table = isl29018_id,
+};
+
+static int __init isl29018_init(void)
+{
+	return i2c_add_driver(&isl29018_driver);
+}
+
+static void __exit isl29018_exit(void)
+{
+	i2c_del_driver(&isl29018_driver);
+}
+
+module_init(isl29018_init);
+module_exit(isl29018_exit);
+
+MODULE_DESCRIPTION("ISL29018 Ambient Light Sensor driver");
+MODULE_LICENSE("GPL");
-- 
1.7.0.4

^ permalink raw reply related

* [PATCH] eglibc-package.bbclass: fix missing RPROVIDES for virtual-locale-*
From: Martin Jansa @ 2010-10-07 19:44 UTC (permalink / raw)
  To: openembedded-devel

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 recipes/eglibc/eglibc-package.bbclass |    4 +++-
 recipes/eglibc/eglibc.inc             |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/recipes/eglibc/eglibc-package.bbclass b/recipes/eglibc/eglibc-package.bbclass
index 5871be0..dbca1ab 100644
--- a/recipes/eglibc/eglibc-package.bbclass
+++ b/recipes/eglibc/eglibc-package.bbclass
@@ -351,7 +351,9 @@ python package_do_split_gconvs () {
 		else:
 		    glibc_name = name
 		bb.data.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('eglibc-binary-localedata-%s' % glibc_name), d)
-		bb.data.setVar('RPROVIDES_%s' % pkgname, 'glibc-binary-localedata-%s' % glibc_name, d)
+		rprovides = bb.data.getVar("RPROVIDES_%s" % pkgname, d, 1)
+		rprovides += ' glibc-binary-localedata-%s' % glibc_name
+		bb.data.setVar('RPROVIDES_%s' % pkgname, rprovides, d)
 
 	def output_locale_binary(name, pkgname, locale, encoding):
 		# This is a hack till linux-libc-headers gets patched for the missing arm syscalls and all arm device kernels as well
diff --git a/recipes/eglibc/eglibc.inc b/recipes/eglibc/eglibc.inc
index a68f343..754a12b 100644
--- a/recipes/eglibc/eglibc.inc
+++ b/recipes/eglibc/eglibc.inc
@@ -3,7 +3,7 @@ HOMEPAGE = "http://www.eglibc.org/home"
 SECTION = "libs"
 PRIORITY = "required"
 LICENSE = "LGPL"
-INC_PR = "r14"
+INC_PR = "r15"
 # nptl needs unwind support in gcc, which can't be built without glibc.
 DEPENDS = "virtual/${TARGET_PREFIX}gcc-intermediate linux-libc-headers"
 #this leads to circular deps, so lets not add it yet
-- 
1.7.3.1




^ permalink raw reply related

* Re: [PATCH RFC 2/2] usb: ehci-omap: add suspend/resume support
From: Laine Walker-Avina @ 2010-10-07 19:47 UTC (permalink / raw)
  To: Gadiyar, Anand
  Cc: Alan Stern, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Gupta, Ajay Kumar
In-Reply-To: <5A47E75E594F054BAF48C5E4FC4B92AB0322D7D8AA-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>

On Fri, May 14, 2010 at 7:01 AM, Gadiyar, Anand <gadiyar-l0cyMroinI0@public.gmane.org> wrote:
> Alan Stern wrote:
>> On Thu, 13 May 2010, Anand Gadiyar wrote:
>>
>> > Add support for suspend and resume to the ehci-omap driver.
>> > Added routines for platform_driver suspend/resume and
>> > wrappers around ehci_bus_suspend/resume.
>>
>> > +#ifdef CONFIG_PM
>> >
>> /*-------------------------------------------------------------------------*/
>> > +static int ehci_omap_dev_suspend(struct device *dev)
>> > +{
>> > +   struct ehci_hcd_omap *omap = dev_get_drvdata(dev);
>> > +
>> > +   if (!omap->suspended)
>> > +           ehci_omap_enable(omap, 0);
>> > +   return 0;
>> > +}
>> > +
>> > +static int ehci_omap_dev_resume(struct device *dev)
>> > +{
>> > +   struct ehci_hcd_omap *omap = dev_get_drvdata(dev);
>> > +
>> > +   if (omap->suspended)
>> > +           ehci_omap_enable(omap, 1);
>> > +   return 0;
>> > +}
>> > +
>> > +static int ehci_omap_bus_suspend(struct usb_hcd *hcd)
>> > +{
>> > +   struct usb_bus *bus = hcd_to_bus(hcd);
>> > +   int ret;
>> > +
>> > +   ret = ehci_bus_suspend(hcd);
>> > +
>> > +   ehci_omap_dev_suspend(bus->controller);
>> > +
>> > +   return ret;
>> > +}
>> > +static int ehci_omap_bus_resume(struct usb_hcd *hcd)
>> > +{
>> > +   struct usb_bus *bus = hcd_to_bus(hcd);
>> > +   int ret;
>> > +
>> > +   ehci_omap_dev_resume(bus->controller);
>> > +
>> > +   ret = ehci_bus_resume(hcd);
>> > +
>> > +   return ret;
>> > +}
>>
>> You could use the runtime-PM interface instead of explicitly suspending
>> and resuming the controller.  It is now standard.
>>
>
> Will work on this. I'll be out for a while, so it could be some time
> before I repost.
>
> Thanks,
> Anand

Any more developments on this?

-- 
Laine Walker-Avina
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP
From: Thomas Petazzoni @ 2010-10-07 19:47 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
In-Reply-To: <1286363699-9614-8-git-send-email-svadivu@ti.com>

Hello Senthil,

On Wed,  6 Oct 2010 16:44:50 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

> +static struct platform_driver omap_dsshw_driver = {
> +	.probe          = omap_dsshw_probe,
> +	.remove         = omap_dsshw_remove,
> +	.shutdown	= NULL,
> +	.suspend	= NULL,
> +	.resume		= NULL,

Those are unneeded, the compiler will initialize those fields to zero
automatically if you don't specify any value.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* Re: [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI Move init,exit to driver
From: Thomas Petazzoni @ 2010-10-07 19:47 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
In-Reply-To: <1286363699-9614-12-git-send-email-svadivu@ti.com>

Hello Senthil,

On Wed,  6 Oct 2010 16:44:54 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

> diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
> index 23598ea..9bee39d 100644
> --- a/drivers/video/omap2/dss/rfbi.c
> +++ b/drivers/video/omap2/dss/rfbi.c
> @@ -100,6 +100,7 @@ static int rfbi_convert_timings(struct rfbi_timings *t);
>  static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div);
>  
>  static struct {
> +	struct platform_device *pdev;
>  	void __iomem	*base;
>  
>  	unsigned long	l4_khz;
> @@ -142,11 +143,22 @@ static inline u32 rfbi_read_reg(const struct rfbi_reg idx)
>  /* RFBI HW IP initialisation */
>  static int omap_rfbihw_probe(struct platform_device *pdev)
>  {
> -	return 0;
> +	int r;
> +	rfbi.pdev = pdev;
> +
> +	r = rfbi_init();
> +	if (r) {
> +		DSSERR("Failed to initialize rfbi\n");
> +		goto err_rfbi;
> +	}
> +
> +err_rfbi:
> +	return r;
>  }
>  
>  static int omap_rfbihw_remove(struct platform_device *pdev)
>  {
> +	rfbi_exit();
>  	return 0;
>  }
>  

Instead of having probe() and remove() functions that call the existing
init() and exit(), why not making your driver look like most Linux
drivers here, and directly do the initialization in probe() and the
cleanup in remove() ?

Concerning the added pdev field to the rfbi structure, do you really it
at this point ?

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* Re: [Xen-devel] [PATCH v7] Xen PCI + Xen PCI frontend driver.
From: Konrad Rzeszutek Wilk @ 2010-10-07 19:44 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Jeremy Fitzhardinge, xen-devel, linux-kernel
In-Reply-To: <20101006225043.GA20211@dumpdata.com>

On Wed, Oct 06, 2010 at 06:50:43PM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Oct 05, 2010 at 08:47:20AM +0100, Jan Beulich wrote:
> > >>> On 04.10.10 at 20:13, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> > > This patch set contains the supporting patches and the driver itself for
> > > Xen Paravirtualized (PV) domains to use PCI pass-through devices (the git 
> > > tree
> > > is git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git 
> > > devel/xen-pcifront-0.7).
> .. snip..
> > Somehow this patch series appears to be incomplete: Neither on
> > xen-devel nor on patchwork I can find patches 6, 11, 18, 19, and 20.
> 
> Shucks! I am not sure what happend, the git-send-email looked to have sent them 
> all.  Let me redo them and resend them with more attention to this.

AHA! I think I know the answer. Those are the patches for which the Author:
is bouncing. Any ideas of what to do except next time just manually respond
and paste in the patches?


^ permalink raw reply

* Re: [PATCH V2 1/1]MMC: add support of sdhci-pxa driver
From: Chris Ball @ 2010-10-07 19:45 UTC (permalink / raw)
  To: zhangfei gao; +Cc: linux-mmc, Wolfram Sang, kmpark, eric.y.miao, Haojian Zhuang
In-Reply-To: <AANLkTikK0oEwLEXaf_Q5XWi3nxoq8WKCzKiF87E_Z3k+@mail.gmail.com>

Hi Zhangfei, all,

On Tue, Sep 28, 2010 at 11:23:35PM -0400, zhangfei gao wrote:
> We strongly prefer using standalone host driver currently, like
> sdhci-s3c.c, the scheme is more mature, more similar as our
> controller, and more flexiable for sharing one controller in different
> platform with different requirement.
> We would rather pay more effort to enable new feature of silicon,  to
> enhance the sdhci.c, which benefit much more silicon vender, instead
> of paying much effort in how to abstract probe and remove.
> For the driver lever, we don't want too much dependence, the more
> dependence, the less stability.
> The sdhci-pltfm has good idea, however currently it does not meet our
> requirement, not say in the future.

Sorry for taking so long to reply to this -- it's been difficult to
decide whether to take this as a non-pltfm driver.

I've decided to take it since our encouragement of platform drivers is
recent, and Eric is also in favor of keeping it separate, and you've
both argued that -pltfm isn't easily able to handle the shared clock
situation on your hardware.  (I'm sure it could be extended to be.)
So, please update the patch in light of Matt Fleming's review comments
and re-submit.

I don't agree, however, with the argument that SDHCI drivers are more
stable if they don't depend on a common core; the common core will
receive more maintenance if more people are using it.  Going forward,
I think that new SDHCI driver work should either use -pltfm or give
strong technical reasons why -pltfm isn't appropriate, and give us a
chance to improve -pltfm in response.  I think we should also consider
converting existing drivers over to platform drivers, even though that's
clearly difficult to accomplish after a driver's been merged. 

Hope that helps to explain the situation as I see it, and I'd be happy
to hear any more comments on the -pltfm approach in general.

Thanks!

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply

* Re: [PATCH 1/2] drivers:bluetooth: TI_ST bluetooth driver
From: Gustavo F. Padovan @ 2010-10-07 19:44 UTC (permalink / raw)
  To: Greg KH
  Cc: Marcel Holtmann, pavan-savoy, linux-bluetooth, johan.hedberg,
	linux-kernel, Pavan Savoy
In-Reply-To: <20101007221737.GA23536@kroah.com>

* Greg KH <greg@kroah.com> [2010-10-07 15:17:37 -0700]:

> On Thu, Oct 07, 2010 at 04:09:06PM -0300, Gustavo F. Padovan wrote:
> > * Greg KH <greg@kroah.com> [2010-10-07 14:30:18 -0700]:
> > 
> > > On Thu, Oct 07, 2010 at 02:51:48PM -0300, Gustavo F. Padovan wrote:
> > > > Hi Greg,
> > > > 
> > > > * Greg KH <greg@kroah.com> [2010-10-07 07:34:09 -0700]:
> > > > 
> > > > > On Thu, Oct 07, 2010 at 12:05:48PM +0200, Marcel Holtmann wrote:
> > > > > > Hi Pavan,
> > > > > > 
> > > > > > > This is the bluetooth protocol driver for the TI WiLink7 chipsets.
> > > > > > > Texas Instrument's WiLink chipsets combine wireless technologies
> > > > > > > like BT, FM, GPS and WLAN onto a single chip.
> > > > > > > 
> > > > > > > This Bluetooth driver works on top of the TI_ST shared transport
> > > > > > > line discipline driver which also allows other drivers like
> > > > > > > FM V4L2 and GPS character driver to make use of the same UART interface.
> > > > > > > 
> > > > > > > Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
> > > > > > > ---
> > > > > > >  drivers/bluetooth/bt_ti.c      |  463 ++++++++++++++++++++++++++++++++++++
> > > > > > >  drivers/staging/ti-st/bt_drv.c |  509 ----------------------------------------
> > > > > > >  drivers/staging/ti-st/bt_drv.h |   61 -----
> > > > > > >  3 files changed, 463 insertions(+), 570 deletions(-)
> > > > > > >  create mode 100644 drivers/bluetooth/bt_ti.c
> > > > > > >  delete mode 100644 drivers/staging/ti-st/bt_drv.c
> > > > > > >  delete mode 100644 drivers/staging/ti-st/bt_drv.h
> > > > > > 
> > > > > > I don't care about staging at all. So you sort that out with Greg.
> > > > > > 
> > > > > > Submit your driver for upstream inclusion. And once accepted you can pin
> > > > > > Greg about removing it.
> > > > > 
> > > > > The driver is already in staging, this is the request to move it out of
> > > > > staging and into the "correct" place in the tree.  The core of the ti-st
> > > > > code is now in the drivers/misc/ directory in the linux-next tree, and
> > > > > this patch is the request to move the bluetooth drive into the proper
> > > > > drivers/bluetooth/ location.
> > > > 
> > > > I'm wondering why this driver never touched linux-bluetooth before. It
> > > > is on staging because it is not ready for a proper merge and while it is
> > > > not ready it needs the comments from the bluetooth developers here to
> > > > get it ready for merge in drivers/bluetooth. So why this never arrived 
> > > > here before?
> > > 
> > > This is the exact reason _why_ it is being sent here now.  To get the
> > > review of the bluetooth developers for any changes that are needed to
> > > get it merged into the proper place in the tree.
> > 
> > Yes, but IMHO it took to long, from what I looked this drivers was merged
> > in stage about May and the patches arrived in linux-bluetooth only in
> > October. Is there a reason for such delay?
> 
> It took that long to get the "obvious" things fixed up.

Ok, I got your point. So let's keep things as is (unless the submitter
also wants the feedback from the subsystem). Thanks for the explanations. ;)

-- 
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi

^ permalink raw reply

* Re: [PATCH v7] Xen PCI + Xen PCI frontend driver.
From: Konrad Rzeszutek Wilk @ 2010-10-07 19:44 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Jeremy Fitzhardinge, xen-devel, linux-kernel
In-Reply-To: <20101006225043.GA20211@dumpdata.com>

On Wed, Oct 06, 2010 at 06:50:43PM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Oct 05, 2010 at 08:47:20AM +0100, Jan Beulich wrote:
> > >>> On 04.10.10 at 20:13, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> > > This patch set contains the supporting patches and the driver itself for
> > > Xen Paravirtualized (PV) domains to use PCI pass-through devices (the git 
> > > tree
> > > is git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git 
> > > devel/xen-pcifront-0.7).
> .. snip..
> > Somehow this patch series appears to be incomplete: Neither on
> > xen-devel nor on patchwork I can find patches 6, 11, 18, 19, and 20.
> 
> Shucks! I am not sure what happend, the git-send-email looked to have sent them 
> all.  Let me redo them and resend them with more attention to this.

AHA! I think I know the answer. Those are the patches for which the Author:
is bouncing. Any ideas of what to do except next time just manually respond
and paste in the patches?

^ permalink raw reply

* AT91: Fix power-saving in idle-mode on 926T processors
From: Anders Larsen @ 2010-10-07 19:44 UTC (permalink / raw)
  To: patches; +Cc: Andrew Victor, linux-arm-kernel, linux-kernel

According to Atmel, their 926T processors (AT91 post RM9200) requires
'Wait for Interrupt' mode be entered right after disabling the processor clock
in order to minimise current consumption when idle, so do both provided we're
not running on a 920T (an RM9200).

Furthermore, get rid of the #ifndef CONFIG_DEBUG_KERNEL, since arch_idle()
can be turned off completely with the kernel parameter 'nohlt'.

Signed-off-by: Anders Larsen <al@alarsen.net>
Cc: Andrew Victor <avictor.za@gmail.com>
---
KernelVersion: 2.6.35

 arch/arm/mach-at91/include/mach/system.h |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
index c80e090..ee8db15 100644
--- a/arch/arm/mach-at91/include/mach/system.h
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -28,17 +28,16 @@
 
 static inline void arch_idle(void)
 {
-#ifndef CONFIG_DEBUG_KERNEL
 	/*
 	 * Disable the processor clock.  The processor will be automatically
 	 * re-enabled by an interrupt or by a reset.
 	 */
 	at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK);
-#else
+#ifndef CONFIG_CPU_ARM920T
 	/*
 	 * Set the processor (CP15) into 'Wait for Interrupt' mode.
-	 * Unlike disabling the processor clock via the PMC (above)
-	 *  this allows the processor to be woken via JTAG.
+	 * Post-RM9200 processors need this in conjunction with the above
+	 * to save power when idle.
 	 */
 	cpu_do_idle();
 #endif
-- 
1.7.0.4


^ permalink raw reply related

* AT91: Fix power-saving in idle-mode on 926T processors
From: Anders Larsen @ 2010-10-07 19:44 UTC (permalink / raw)
  To: linux-arm-kernel

According to Atmel, their 926T processors (AT91 post RM9200) requires
'Wait for Interrupt' mode be entered right after disabling the processor clock
in order to minimise current consumption when idle, so do both provided we're
not running on a 920T (an RM9200).

Furthermore, get rid of the #ifndef CONFIG_DEBUG_KERNEL, since arch_idle()
can be turned off completely with the kernel parameter 'nohlt'.

Signed-off-by: Anders Larsen <al@alarsen.net>
Cc: Andrew Victor <avictor.za@gmail.com>
---
KernelVersion: 2.6.35

 arch/arm/mach-at91/include/mach/system.h |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
index c80e090..ee8db15 100644
--- a/arch/arm/mach-at91/include/mach/system.h
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -28,17 +28,16 @@
 
 static inline void arch_idle(void)
 {
-#ifndef CONFIG_DEBUG_KERNEL
 	/*
 	 * Disable the processor clock.  The processor will be automatically
 	 * re-enabled by an interrupt or by a reset.
 	 */
 	at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK);
-#else
+#ifndef CONFIG_CPU_ARM920T
 	/*
 	 * Set the processor (CP15) into 'Wait for Interrupt' mode.
-	 * Unlike disabling the processor clock via the PMC (above)
-	 *  this allows the processor to be woken via JTAG.
+	 * Post-RM9200 processors need this in conjunction with the above
+	 * to save power when idle.
 	 */
 	cpu_do_idle();
 #endif
-- 
1.7.0.4

^ permalink raw reply related

* Re: [Qemu-devel] [PATCH 07/11] cris: avoid write only variables
From: Edgar E. Iglesias @ 2010-10-07 19:44 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Markus Armbruster, qemu-devel
In-Reply-To: <AANLkTinYkdozgtg7+zNyij2LtFnDG-9jE9AMJwK7PizA@mail.gmail.com>

On Thu, Oct 07, 2010 at 05:57:30PM +0000, Blue Swirl wrote:
> On Thu, Oct 7, 2010 at 11:07 AM, Edgar E. Iglesias
> <edgar.iglesias@gmail.com> wrote:
> > On Thu, Oct 07, 2010 at 12:08:05PM +0200, Markus Armbruster wrote:
> >> Blue Swirl <blauwirbel@gmail.com> writes:
> >>
> >> > Compiling with GCC 4.6.0 20100925 produced warnings:

[...]

> > Markus, I agree that removing tlb_v would have been better than ifdefs,
> > but i think that the intent I originally had in mind was that there should
> > not be a need to flush the entry from the QEMU TLB if the old guest
> > entry was not valid.
> >
> >
> > The following patch works on my side:
> >
> > diff --git a/target-cris/op_helper.c b/target-cris/op_helper.c
> > index a60da94..be9eb06 100644
> > --- a/target-cris/op_helper.c
> > +++ b/target-cris/op_helper.c
> > @@ -164,7 +164,9 @@ void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg)
> >
> >                        D_LOG("tlb flush vaddr=%x v=%d pc=%x\n",
> >                                  vaddr, tlb_v, env->pc);
> > -                       tlb_flush_page(env, vaddr);
> > +                       if (tlb_v) {
> > +                               tlb_flush_page(env, vaddr);
> > +                       }
> >                }
> >        }
> >  #endif
> >
> >
> > The target-cris/translate_v10.c hunk looks good.
> >
> > Blue, can you incorporate the tlb_v change in your patch set?
> > Or if you prefer, I can commit that part on my side.
> 
> Please do.

OK, done.

Thanks

^ permalink raw reply

* Re: libgee_0.6.0: gee/Makefile.am:95: HAVE_INTROSPECTION does not appear in AM_CONDITIONAL
From: Steve Sakoman @ 2010-10-07 19:35 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Michael 'Mickey' Lauer
In-Reply-To: <1286408038.3829.22.camel@mattotaupa>

On Wed, Oct 6, 2010 at 4:33 PM, Paul Menzel
<paulepanter@users.sourceforge.net> wrote:
> Dear OE folks,
>
>
> `configure` fails for me for `libgee_0.6.0.bb` [1].
>
>        | gee/Makefile.am:95: HAVE_INTROSPECTION does not appear in AM_CONDITIONAL
>
> `libgee_0.5.2.bb` builds correctly because it does not yet use gobject-introspection.
>
> This question was brought up before but was left unanswered [2].
>
> There was no file `introspection.m4`, where `HAVE_INTROSPECTION` is
> defined in, in
>
>        …/work/armv7a-oe-linux-gnueabi/libgee-1_0.6.0-r1/libgee-0.6.0/m4
>
> as recommended in [3]. Should the m4 file be copied there as it is done
> for the other m4 files?
>
>        […]
>        | autoreconf: configure.ac: tracing
>        | autoreconf: running: libtoolize --copy --force
>        | libtoolize: putting auxiliary files in `.'.
>        | libtoolize: copying file `./ltmain.sh'
>        | libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
>        | libtoolize: copying file `m4/libtool.m4'
>        | libtoolize: copying file `m4/ltoptions.m4'
>        | libtoolize: copying file `m4/ltsugar.m4'
>        | libtoolize: copying file `m4/ltversion.m4'
>        | libtoolize: copying file `m4/lt~obsolete.m4'
>        […]
>
> I manually put the m4 file [4] into `libgee-0.6.0/m4/` and added
> `m4/introspection.m4` to `EXTRA_DIST` in `Makefile.am` to `` but
>
>        bitbake -c configure libgee
>
> still failed.
>
> Do you have any ideas?

I found that if I built gobject-introspection-native manually, then
libgee would complete without error.

The DEPENDS_virtclass-native = "gobject-introspection-native" in the
libgee recipe isn't triggering the build automatically.

Steve



^ permalink raw reply

* Re: [PATCH] percpu_counter: change inaccurate comment
From: Christoph Lameter @ 2010-10-07 19:42 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Andrew Morton, linux-kernel
In-Reply-To: <1286469421.2912.240.camel@edumazet-laptop>

On Thu, 7 Oct 2010, Eric Dumazet wrote:

> percpu_counter used to be huge objects, they are not anymore,
> thanks to fine alloc_percpu() granularity.
>
> We now consume 4 bytes per possible cpu.

Ahh I did not notice that they switched.... Then we may also want the
following patch to improve performance. It would even be better if we
could do a this_cpu_add(fbc->counters, amount) there but the 64 bit size
fo count looks suspiciously like you are expecting overflows beyond ints
max size.


Subject: percpu_counter: Use this_cpu_ptr instead of per_cpu_ptr

this_cpu_ptr avoids an array lookup and can use the percpu
offset of the local cpu directly.

Signed-off-by: Christoph Lameter <cl@linux.com>

---
 lib/percpu_counter.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6/lib/percpu_counter.c
===================================================================
--- linux-2.6.orig/lib/percpu_counter.c	2010-10-07 14:36:39.000000000 -0500
+++ linux-2.6/lib/percpu_counter.c	2010-10-07 14:38:43.000000000 -0500
@@ -30,9 +30,9 @@ void __percpu_counter_add(struct percpu_
 {
 	s64 count;
 	s32 *pcount;
-	int cpu = get_cpu();

-	pcount = per_cpu_ptr(fbc->counters, cpu);
+	preempt_disable();
+	pcount = this_cpu_ptr(fbc->counters);
 	count = *pcount + amount;
 	if (count >= batch || count <= -batch) {
 		spin_lock(&fbc->lock);
@@ -42,7 +42,7 @@ void __percpu_counter_add(struct percpu_
 	} else {
 		*pcount = count;
 	}
-	put_cpu();
+	preempt_enable();
 }
 EXPORT_SYMBOL(__percpu_counter_add);


^ permalink raw reply

* [Bug 30483] r600g makes kwin (ab)use 100% CPU
From: bugzilla-daemon @ 2010-10-07 19:41 UTC (permalink / raw)
  To: dri-devel
In-Reply-To: <bug-30483-502@http.bugs.freedesktop.org/>

https://bugs.freedesktop.org/show_bug.cgi?id=30483

--- Comment #4 from Jerome Glisse <glisse@freedesktop.org> 2010-10-07 12:41:57 PDT ---
Can we have the profiling data attached to bug ?

Btw sysprof is lot easier to use

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply

* Re: [PATCH] mtd/nand.h: little more cleanup
From: Sebastian Andrzej Siewior @ 2010-10-07 19:41 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd, Wolfram Sang
In-Reply-To: <1286479829.1797.12.camel@brekeke>

Artem Bityutskiy wrote:
> drivers/mtd/nand/nand_base.c: In function ‘nand_command’:
> drivers/mtd/nand/nand_base.c:589: error: ‘struct nand_chip’ has no member named ‘chipsize’
> drivers/mtd/nand/nand_base.c: In function ‘nand_command_lp’:
> drivers/mtd/nand/nand_base.c:680: error: ‘struct nand_chip’ has no member named ‘chipsize’
> drivers/mtd/nand/nand_base.c: In function ‘nand_flash_detect_onfi’:
> drivers/mtd/nand/nand_base.c:2890: error: ‘struct nand_chip’ has no member named ‘chipsize’
> drivers/mtd/nand/nand_base.c: In function ‘nand_get_flash_type’:
> drivers/mtd/nand/nand_base.c:2977: error: ‘struct nand_chip’ has no member named ‘chipsize’
> drivers/mtd/nand/nand_base.c:3099: error: ‘struct nand_chip’ has no member named ‘chipsize’
> drivers/mtd/nand/nand_base.c:3103: error: ‘struct nand_chip’ has no member named ‘chipsize’
> drivers/mtd/nand/nand_base.c:3104: error: ‘struct nand_chip’ has no member named ‘chipsize’
> drivers/mtd/nand/nand_base.c:3106: error: ‘struct nand_chip’ has no member named ‘chipsize’
> drivers/mtd/nand/nand_base.c: In function ‘nand_scan_ident’:
> drivers/mtd/nand/nand_base.c:3216: error: ‘struct nand_chip’ has no member named ‘chipsize’

I'm very sorry for that. I fix is coming in a jiffy or two.

Sebastian

^ permalink raw reply

* Re: [fix-isi-udev PATCH 0/3] Improve udev with isi
From: Aki Niemi @ 2010-10-07 19:41 UTC (permalink / raw)
  To: ofono
In-Reply-To: <1286197866-19572-1-git-send-email-Pekka.Pessi@nokia.com>

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

Hi Pekka,

On Mon, 2010-10-04 at 15:11 +0200, ext Pekka.Pessi(a)nokia.com wrote:
> [fix-isi-udev PATCH 1/3] udev: do not use post-143 libudev features
> [fix-isi-udev PATCH 2/3] udev: refactor add_isi

These two were applied. Thanks!

> [fix-isi-udev PATCH 3/3] ofono.rules: assign isigen driver by USB ids

This one was left dangling; let's see if we can come up with a better
way to match the modems driven by cdc_phonet. (Although, admittedly this
same approach is already used with some AT modems.)

Cheers,
Aki


^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.