Re: [PATCH v2] input: add driver support for Sharp gp2ap002a00f proximity sensor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shubhrajyoti,

Thanks for reviewing!

On 17:52 Mon 14 Nov     , Shubhrajyoti Datta wrote:
>    Hi Courtney,
>    Some minor comments
> 
>    On Mon, Nov 14, 2011 at 9:09 PM, <[1]oskar.andero@xxxxxxxxxxxxxxxx>
>    wrote:
> 
>      From: Courtney Cavin <[2]courtney.cavin@xxxxxxxxxxxxxxxx>
>      Signed-off-by: Courtney Cavin <[3]courtney.cavin@xxxxxxxxxxxxxxxx>
>      Signed-off-by: Oskar Andero <[4]oskar.andero@xxxxxxxxxxxxxxxx>
>      ---
>       drivers/input/misc/Kconfig         |   11 ++
>       drivers/input/misc/Makefile        |    1 +
>       drivers/input/misc/gp2ap002a00f.c  |  286
>      ++++++++++++++++++++++++++++++++++++
>       include/linux/input/gp2ap002a00f.h |   22 +++
>       4 files changed, 320 insertions(+), 0 deletions(-)
>       create mode 100644 drivers/input/misc/gp2ap002a00f.c
>       create mode 100644 include/linux/input/gp2ap002a00f.h
>      diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
>      index 22d875f..dee96a0 100644
>      --- a/drivers/input/misc/Kconfig
>      +++ b/drivers/input/misc/Kconfig
>      @@ -544,4 +544,15 @@ config INPUT_XEN_KBDDEV_FRONTEND
>               To compile this driver as a module, choose M here: the
>               module will be called xen-kbdfront.
>      +config INPUT_GP2A
>      +       tristate "Sharp GP2AP002A00F I2C Proximity/Opto sensor
>      driver"
>      +       depends on I2C
>      +       default n
> 
>    you may want to drop it as default is anyways n.
> 
>      +       help
>      +         Say Y here if you have a Sharp GP2AP002A00F proximity/als
>      combo-chip
>      +         hooked to an I2C bus.
>      +
>      +         To compile this driver as a module, choose M here: the
>      +         module will be called gp2ap002a00f.
>      +
>       endif
>      diff --git a/drivers/input/misc/Makefile
>      b/drivers/input/misc/Makefile
>      index a244fc6..1681993 100644
>      --- a/drivers/input/misc/Makefile
>      +++ b/drivers/input/misc/Makefile
>      @@ -22,6 +22,7 @@ obj-$(CONFIG_INPUT_CMA3000)           +=
>      cma3000_d0x.o
>       obj-$(CONFIG_INPUT_CMA3000_I2C)                += cma3000_d0x_i2c.o
>       obj-$(CONFIG_INPUT_COBALT_BTNS)                += cobalt_btns.o
>       obj-$(CONFIG_INPUT_DM355EVM)           += dm355evm_keys.o
>      +obj-$(CONFIG_INPUT_GP2A)               += gp2ap002a00f.o
>       obj-$(CONFIG_HP_SDC_RTC)               += hp_sdc_rtc.o
>       obj-$(CONFIG_INPUT_IXP4XX_BEEPER)      += ixp4xx-beeper.o
>       obj-$(CONFIG_INPUT_KEYSPAN_REMOTE)     += keyspan_remote.o
>      diff --git a/drivers/input/misc/gp2ap002a00f.c
>      b/drivers/input/misc/gp2ap002a00f.c
>      new file mode 100644
>      index 0000000..1c5ddf8
>      --- /dev/null
>      +++ b/drivers/input/misc/gp2ap002a00f.c
>      @@ -0,0 +1,286 @@
>      +/*
>      + * Copyright (C) 2009,2010 Sony Ericsson Mobile Communications Inc.
> 
>    May want to check the year.
> 
>      + *
>      + * Author: Courtney Cavin <[5]courtney.cavin@xxxxxxxxxxxxxxxx>
>      + * Prepared for up-stream by: Oskar Andero
>      <[6]oskar.andero@xxxxxxxxxxxxxxxx>
> 
>      + *
>      + * This program is free software; you can redistribute it and/or
>      modify
>      + * it under the terms of the GNU General Public License version 2,
>      as
>      + * published by the Free Software Foundation.
>      + */
>      +
>      +#include <linux/i2c.h>
>      +#include <linux/irq.h>
>      +#include <linux/slab.h>
>      +#include <linux/input.h>
>      +#include <linux/module.h>
>      +#include <linux/workqueue.h>
> 
>    Are all these header files needed?
> 
>      +#include <linux/interrupt.h>
>      +#include <linux/gpio.h>
>      +#include <linux/delay.h>
>      +#include <linux/input/gp2ap002a00f.h>
>      +
>      +struct gp2a_data {
>      +       struct input_dev *device;
>      +       const struct gp2a_platform_data *pdata;
>      +       struct i2c_client *i2c_client;
>      +};
>      +
>      +enum gp2a_addr {
>      +       GP2A_ADDR_PROX  = 0x0,
>      +       GP2A_ADDR_GAIN  = 0x1,
>      +       GP2A_ADDR_HYS   = 0x2,
>      +       GP2A_ADDR_CYCLE = 0x3,
>      +       GP2A_ADDR_OPMOD = 0x4,
>      +       GP2A_ADDR_CON   = 0x6
>      +};
>      +
>      +enum gp2a_controls {
>      +       GP2A_CTRL_SSD   = 0x01
> 
>    Not a comment really
>    Could you explain SSD?

SSD means Software shutdown according to the datasheet where 0 puts the
chip in shutdown and 1 in normal operation. I'll add a comment in the code.

-Oskar
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux