Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-12-19 Thread Mark Brown
On Tue, Dec 18, 2012 at 07:07:28PM -0800, Andrey Smirnov wrote:
> On 12-12-18 11:37 AM, Mauro Carvalho Chehab wrote:
> >Em Mon, 8 Oct 2012 11:38:01 -0700
> >Andrey Smirnov  escreveu:

Guys, please delete irrelevant context from mails.  I just TL;DRed this
so if there's anything you're expecting from me on this please let me
know.

> >
> >>On 10/08/2012 01:43 AM, Hans Verkuil wrote:
> >>>On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
> This patch adds all necessary header files and Kbuild plumbing for the
> core driver for Silicon Laboratories Si476x series of AM/FM tuner
> chips.
> 
> The driver as a whole is implemented as an MFD device and this patch
> adds a core portion of it that provides all the necessary
> functionality to the two other drivers that represent radio and audio
> codec subsystems of the chip.
> 
> Signed-off-by: Andrey Smirnov 
> ---
>   drivers/mfd/Kconfig |   14 ++
>   drivers/mfd/Makefile|3 +
>   include/linux/mfd/si476x-core.h |  529 
>  +++
>   include/media/si476x.h  |  449 +
>   4 files changed, 995 insertions(+)
>   create mode 100644 include/linux/mfd/si476x-core.h
>   create mode 100644 include/media/si476x.h
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index b1a1462..3fab06d 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -895,6 +895,20 @@ config MFD_WL1273_CORE
> driver connects the radio-wl1273 V4L2 module and the wl1273
> audio codec.
> +config MFD_SI476X_CORE
> + tristate "Support for Silicon Laboratories 4761/64/68 AM/FM radio."
> + depends on I2C
> + select MFD_CORE
> + default n
> + help
> +   This is the core driver for the SI476x series of AM/FM radio. This MFD
> +   driver connects the radio-si476x V4L2 module and the si476x
> +   audio codec.
> +
> +   To compile this driver as a module, choose M here: the
> +   module will be called si476x-core.
> +
> +
>   config MFD_OMAP_USB_HOST
>   bool "Support OMAP USBHS core driver"
>   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 79dd22d..942257b 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583) += rc5t583.o 
> rc5t583-irq.o
>   obj-$(CONFIG_MFD_SEC_CORE)  += sec-core.o sec-irq.o
>   obj-$(CONFIG_MFD_ANATOP)+= anatop-mfd.o
>   obj-$(CONFIG_MFD_LM3533)+= lm3533-core.o lm3533-ctrlbank.o
> +
> +si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
> +obj-$(CONFIG_MFD_SI476X_CORE)+= si476x-core.o
> diff --git a/include/linux/mfd/si476x-core.h 
> b/include/linux/mfd/si476x-core.h
> new file mode 100644
> index 000..eb6f52a
> --- /dev/null
> +++ b/include/linux/mfd/si476x-core.h
> @@ -0,0 +1,529 @@
> +/*
> + * include/media/si476x-core.h -- Common definitions for si476x core
> + * device
> + *
> + * Copyright (C) 2012 Innovative Converged Devices(ICD)
> + *
> + * Author: Andrey Smirnov 
> + *
> + * 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; version 2 of the License.
> + *
> + * 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.
> + *
> + */
> +
> +#ifndef SI476X_CORE_H
> +#define SI476X_CORE_H
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#ifdef DEBUG
> +#define DBG_BUFFER(device, header, buffer, bcount)   
> \
> + do {\
> + dev_info((device), header); \
> + print_hex_dump_bytes("",\
> +  DUMP_PREFIX_OFFSET,\
> +  buffer, bcount);   \
> + } while (0)
> +#else
> +#define DBG_BUFFER(device, header, buffer, bcount)   
> \
> + do {} while (0)
> +#endif
> +
> +enum si476x_freq_suppoted_chips {
> >>>typo: suppoted -> supported
> >>>
> + SI476X_CHIP_SI4761 = 1,
> + SI476X_CHIP_SI4762,
> + SI476X_CHIP_SI4763,
> + SI476X_CHIP_SI4764,
> + SI476X_CHIP_SI4768,
> + 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-12-19 Thread Mark Brown
On Tue, Dec 18, 2012 at 07:07:28PM -0800, Andrey Smirnov wrote:
 On 12-12-18 11:37 AM, Mauro Carvalho Chehab wrote:
 Em Mon, 8 Oct 2012 11:38:01 -0700
 Andrey Smirnov andrey.smir...@convergeddevices.net escreveu:

Guys, please delete irrelevant context from mails.  I just TL;DRed this
so if there's anything you're expecting from me on this please let me
know.

 
 On 10/08/2012 01:43 AM, Hans Verkuil wrote:
 On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
 This patch adds all necessary header files and Kbuild plumbing for the
 core driver for Silicon Laboratories Si476x series of AM/FM tuner
 chips.
 
 The driver as a whole is implemented as an MFD device and this patch
 adds a core portion of it that provides all the necessary
 functionality to the two other drivers that represent radio and audio
 codec subsystems of the chip.
 
 Signed-off-by: Andrey Smirnov andrey.smir...@convergeddevices.net
 ---
   drivers/mfd/Kconfig |   14 ++
   drivers/mfd/Makefile|3 +
   include/linux/mfd/si476x-core.h |  529 
  +++
   include/media/si476x.h  |  449 +
   4 files changed, 995 insertions(+)
   create mode 100644 include/linux/mfd/si476x-core.h
   create mode 100644 include/media/si476x.h
 
 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index b1a1462..3fab06d 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -895,6 +895,20 @@ config MFD_WL1273_CORE
 driver connects the radio-wl1273 V4L2 module and the wl1273
 audio codec.
 +config MFD_SI476X_CORE
 + tristate Support for Silicon Laboratories 4761/64/68 AM/FM radio.
 + depends on I2C
 + select MFD_CORE
 + default n
 + help
 +   This is the core driver for the SI476x series of AM/FM radio. This MFD
 +   driver connects the radio-si476x V4L2 module and the si476x
 +   audio codec.
 +
 +   To compile this driver as a module, choose M here: the
 +   module will be called si476x-core.
 +
 +
   config MFD_OMAP_USB_HOST
   bool Support OMAP USBHS core driver
   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
 index 79dd22d..942257b 100644
 --- a/drivers/mfd/Makefile
 +++ b/drivers/mfd/Makefile
 @@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583) += rc5t583.o 
 rc5t583-irq.o
   obj-$(CONFIG_MFD_SEC_CORE)  += sec-core.o sec-irq.o
   obj-$(CONFIG_MFD_ANATOP)+= anatop-mfd.o
   obj-$(CONFIG_MFD_LM3533)+= lm3533-core.o lm3533-ctrlbank.o
 +
 +si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
 +obj-$(CONFIG_MFD_SI476X_CORE)+= si476x-core.o
 diff --git a/include/linux/mfd/si476x-core.h 
 b/include/linux/mfd/si476x-core.h
 new file mode 100644
 index 000..eb6f52a
 --- /dev/null
 +++ b/include/linux/mfd/si476x-core.h
 @@ -0,0 +1,529 @@
 +/*
 + * include/media/si476x-core.h -- Common definitions for si476x core
 + * device
 + *
 + * Copyright (C) 2012 Innovative Converged Devices(ICD)
 + *
 + * Author: Andrey Smirnov andrey.smir...@convergeddevices.net
 + *
 + * 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; version 2 of the License.
 + *
 + * 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.
 + *
 + */
 +
 +#ifndef SI476X_CORE_H
 +#define SI476X_CORE_H
 +
 +#include linux/kfifo.h
 +#include linux/atomic.h
 +#include linux/i2c.h
 +#include linux/mutex.h
 +#include linux/mfd/core.h
 +#include linux/videodev2.h
 +
 +#include media/si476x.h
 +
 +#ifdef DEBUG
 +#define DBG_BUFFER(device, header, buffer, bcount)   
 \
 + do {\
 + dev_info((device), header); \
 + print_hex_dump_bytes(,\
 +  DUMP_PREFIX_OFFSET,\
 +  buffer, bcount);   \
 + } while (0)
 +#else
 +#define DBG_BUFFER(device, header, buffer, bcount)   
 \
 + do {} while (0)
 +#endif
 +
 +enum si476x_freq_suppoted_chips {
 typo: suppoted - supported
 
 + SI476X_CHIP_SI4761 = 1,
 + SI476X_CHIP_SI4762,
 + SI476X_CHIP_SI4763,
 + SI476X_CHIP_SI4764,
 + SI476X_CHIP_SI4768,
 + SI476X_CHIP_SI4769,
 +};
 +
 +enum si476x_mfd_cells {
 + SI476X_RADIO_CELL = 0,
 + SI476X_CODEC_CELL,
 + SI476X_MFD_CELLS,
 +};
 +
 +
 +/**
 + * enum si476x_power_state - possible power state of the si476x
 + * device.
 + *
 + * @SI476X_POWER_DOWN: In this state all regulators are turned off
 + * and the reset line is pulled low. The device is completely
 + * inactive.
 + * @SI476X_POWER_UP_FULL: In this state all the 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-12-18 Thread Andrey Smirnov

On 12-12-18 11:37 AM, Mauro Carvalho Chehab wrote:

Em Mon, 8 Oct 2012 11:38:01 -0700
Andrey Smirnov  escreveu:


On 10/08/2012 01:43 AM, Hans Verkuil wrote:

On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:

This patch adds all necessary header files and Kbuild plumbing for the
core driver for Silicon Laboratories Si476x series of AM/FM tuner
chips.

The driver as a whole is implemented as an MFD device and this patch
adds a core portion of it that provides all the necessary
functionality to the two other drivers that represent radio and audio
codec subsystems of the chip.

Signed-off-by: Andrey Smirnov 
---
  drivers/mfd/Kconfig |   14 ++
  drivers/mfd/Makefile|3 +
  include/linux/mfd/si476x-core.h |  529 +++
  include/media/si476x.h  |  449 +
  4 files changed, 995 insertions(+)
  create mode 100644 include/linux/mfd/si476x-core.h
  create mode 100644 include/media/si476x.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b1a1462..3fab06d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -895,6 +895,20 @@ config MFD_WL1273_CORE
  driver connects the radio-wl1273 V4L2 module and the wl1273
  audio codec.
  
+config MFD_SI476X_CORE

+   tristate "Support for Silicon Laboratories 4761/64/68 AM/FM radio."
+   depends on I2C
+   select MFD_CORE
+   default n
+   help
+ This is the core driver for the SI476x series of AM/FM radio. This MFD
+ driver connects the radio-si476x V4L2 module and the si476x
+ audio codec.
+
+ To compile this driver as a module, choose M here: the
+ module will be called si476x-core.
+
+
  config MFD_OMAP_USB_HOST
bool "Support OMAP USBHS core driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 79dd22d..942257b 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583)   += rc5t583.o rc5t583-irq.o
  obj-$(CONFIG_MFD_SEC_CORE)+= sec-core.o sec-irq.o
  obj-$(CONFIG_MFD_ANATOP)  += anatop-mfd.o
  obj-$(CONFIG_MFD_LM3533)  += lm3533-core.o lm3533-ctrlbank.o
+
+si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
+obj-$(CONFIG_MFD_SI476X_CORE)  += si476x-core.o
diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h
new file mode 100644
index 000..eb6f52a
--- /dev/null
+++ b/include/linux/mfd/si476x-core.h
@@ -0,0 +1,529 @@
+/*
+ * include/media/si476x-core.h -- Common definitions for si476x core
+ * device
+ *
+ * Copyright (C) 2012 Innovative Converged Devices(ICD)
+ *
+ * Author: Andrey Smirnov 
+ *
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ */
+
+#ifndef SI476X_CORE_H
+#define SI476X_CORE_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#ifdef DEBUG
+#define DBG_BUFFER(device, header, buffer, bcount) \
+   do {\
+   dev_info((device), header); \
+   print_hex_dump_bytes("",  \
+DUMP_PREFIX_OFFSET,\
+buffer, bcount);   \
+   } while (0)
+#else
+#define DBG_BUFFER(device, header, buffer, bcount) \
+   do {} while (0)
+#endif
+
+enum si476x_freq_suppoted_chips {

typo: suppoted -> supported


+   SI476X_CHIP_SI4761 = 1,
+   SI476X_CHIP_SI4762,
+   SI476X_CHIP_SI4763,
+   SI476X_CHIP_SI4764,
+   SI476X_CHIP_SI4768,
+   SI476X_CHIP_SI4769,
+};
+
+enum si476x_mfd_cells {
+   SI476X_RADIO_CELL = 0,
+   SI476X_CODEC_CELL,
+   SI476X_MFD_CELLS,
+};
+
+
+/**
+ * enum si476x_power_state - possible power state of the si476x
+ * device.
+ *
+ * @SI476X_POWER_DOWN: In this state all regulators are turned off
+ * and the reset line is pulled low. The device is completely
+ * inactive.
+ * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
+ * turned on, reset line pulled high, IRQ line is enabled(polling is
+ * active for polling use scenario) and device is turned on with
+ * POWER_UP command. The device is ready to be used.
+ * @SI476X_POWER_INCONSISTENT: This state indicates that previous
+ * power down was inconsisten meaning some of he regulators wer not
+ * turned down and thus the consequent use of the device, without

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-12-18 Thread Mauro Carvalho Chehab
Em Mon, 8 Oct 2012 11:38:01 -0700
Andrey Smirnov  escreveu:

> On 10/08/2012 01:43 AM, Hans Verkuil wrote:
> > On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
> >> This patch adds all necessary header files and Kbuild plumbing for the
> >> core driver for Silicon Laboratories Si476x series of AM/FM tuner
> >> chips.
> >>
> >> The driver as a whole is implemented as an MFD device and this patch
> >> adds a core portion of it that provides all the necessary
> >> functionality to the two other drivers that represent radio and audio
> >> codec subsystems of the chip.
> >>
> >> Signed-off-by: Andrey Smirnov 
> >> ---
> >>  drivers/mfd/Kconfig |   14 ++
> >>  drivers/mfd/Makefile|3 +
> >>  include/linux/mfd/si476x-core.h |  529 
> >> +++
> >>  include/media/si476x.h  |  449 +
> >>  4 files changed, 995 insertions(+)
> >>  create mode 100644 include/linux/mfd/si476x-core.h
> >>  create mode 100644 include/media/si476x.h
> >>
> >> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> >> index b1a1462..3fab06d 100644
> >> --- a/drivers/mfd/Kconfig
> >> +++ b/drivers/mfd/Kconfig
> >> @@ -895,6 +895,20 @@ config MFD_WL1273_CORE
> >>  driver connects the radio-wl1273 V4L2 module and the wl1273
> >>  audio codec.
> >>  
> >> +config MFD_SI476X_CORE
> >> +  tristate "Support for Silicon Laboratories 4761/64/68 AM/FM radio."
> >> +  depends on I2C
> >> +  select MFD_CORE
> >> +  default n
> >> +  help
> >> +This is the core driver for the SI476x series of AM/FM radio. This MFD
> >> +driver connects the radio-si476x V4L2 module and the si476x
> >> +audio codec.
> >> +
> >> +To compile this driver as a module, choose M here: the
> >> +module will be called si476x-core.
> >> +
> >> +
> >>  config MFD_OMAP_USB_HOST
> >>bool "Support OMAP USBHS core driver"
> >>depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
> >> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> >> index 79dd22d..942257b 100644
> >> --- a/drivers/mfd/Makefile
> >> +++ b/drivers/mfd/Makefile
> >> @@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583)  += rc5t583.o 
> >> rc5t583-irq.o
> >>  obj-$(CONFIG_MFD_SEC_CORE)+= sec-core.o sec-irq.o
> >>  obj-$(CONFIG_MFD_ANATOP)  += anatop-mfd.o
> >>  obj-$(CONFIG_MFD_LM3533)  += lm3533-core.o lm3533-ctrlbank.o
> >> +
> >> +si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
> >> +obj-$(CONFIG_MFD_SI476X_CORE) += si476x-core.o
> >> diff --git a/include/linux/mfd/si476x-core.h 
> >> b/include/linux/mfd/si476x-core.h
> >> new file mode 100644
> >> index 000..eb6f52a
> >> --- /dev/null
> >> +++ b/include/linux/mfd/si476x-core.h
> >> @@ -0,0 +1,529 @@
> >> +/*
> >> + * include/media/si476x-core.h -- Common definitions for si476x core
> >> + * device
> >> + *
> >> + * Copyright (C) 2012 Innovative Converged Devices(ICD)
> >> + *
> >> + * Author: Andrey Smirnov 
> >> + *
> >> + * 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; version 2 of the License.
> >> + *
> >> + * 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.
> >> + *
> >> + */
> >> +
> >> +#ifndef SI476X_CORE_H
> >> +#define SI476X_CORE_H
> >> +
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +#include 
> >> +
> >> +#include 
> >> +
> >> +#ifdef DEBUG
> >> +#define DBG_BUFFER(device, header, buffer, bcount)
> >> \
> >> +  do {\
> >> +  dev_info((device), header); \
> >> +  print_hex_dump_bytes("",\
> >> +   DUMP_PREFIX_OFFSET,\
> >> +   buffer, bcount);   \
> >> +  } while (0)
> >> +#else
> >> +#define DBG_BUFFER(device, header, buffer, bcount)
> >> \
> >> +  do {} while (0)
> >> +#endif
> >> +
> >> +enum si476x_freq_suppoted_chips {
> > typo: suppoted -> supported
> >
> >> +  SI476X_CHIP_SI4761 = 1,
> >> +  SI476X_CHIP_SI4762,
> >> +  SI476X_CHIP_SI4763,
> >> +  SI476X_CHIP_SI4764,
> >> +  SI476X_CHIP_SI4768,
> >> +  SI476X_CHIP_SI4769,
> >> +};
> >> +
> >> +enum si476x_mfd_cells {
> >> +  SI476X_RADIO_CELL = 0,
> >> +  SI476X_CODEC_CELL,
> >> +  SI476X_MFD_CELLS,
> >> +};
> >> +
> >> +
> >> +/**
> >> + * enum si476x_power_state - possible power state of the si476x
> >> + * device.
> >> + *
> >> + * @SI476X_POWER_DOWN: In this state all regulators are turned off
> >> + * and the reset line is pulled low. The device is completely
> >> + * 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-12-18 Thread Mauro Carvalho Chehab
Em Mon, 8 Oct 2012 11:38:01 -0700
Andrey Smirnov andrey.smir...@convergeddevices.net escreveu:

 On 10/08/2012 01:43 AM, Hans Verkuil wrote:
  On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
  This patch adds all necessary header files and Kbuild plumbing for the
  core driver for Silicon Laboratories Si476x series of AM/FM tuner
  chips.
 
  The driver as a whole is implemented as an MFD device and this patch
  adds a core portion of it that provides all the necessary
  functionality to the two other drivers that represent radio and audio
  codec subsystems of the chip.
 
  Signed-off-by: Andrey Smirnov andrey.smir...@convergeddevices.net
  ---
   drivers/mfd/Kconfig |   14 ++
   drivers/mfd/Makefile|3 +
   include/linux/mfd/si476x-core.h |  529 
  +++
   include/media/si476x.h  |  449 +
   4 files changed, 995 insertions(+)
   create mode 100644 include/linux/mfd/si476x-core.h
   create mode 100644 include/media/si476x.h
 
  diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
  index b1a1462..3fab06d 100644
  --- a/drivers/mfd/Kconfig
  +++ b/drivers/mfd/Kconfig
  @@ -895,6 +895,20 @@ config MFD_WL1273_CORE
   driver connects the radio-wl1273 V4L2 module and the wl1273
   audio codec.
   
  +config MFD_SI476X_CORE
  +  tristate Support for Silicon Laboratories 4761/64/68 AM/FM radio.
  +  depends on I2C
  +  select MFD_CORE
  +  default n
  +  help
  +This is the core driver for the SI476x series of AM/FM radio. This MFD
  +driver connects the radio-si476x V4L2 module and the si476x
  +audio codec.
  +
  +To compile this driver as a module, choose M here: the
  +module will be called si476x-core.
  +
  +
   config MFD_OMAP_USB_HOST
 bool Support OMAP USBHS core driver
 depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
  diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
  index 79dd22d..942257b 100644
  --- a/drivers/mfd/Makefile
  +++ b/drivers/mfd/Makefile
  @@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583)  += rc5t583.o 
  rc5t583-irq.o
   obj-$(CONFIG_MFD_SEC_CORE)+= sec-core.o sec-irq.o
   obj-$(CONFIG_MFD_ANATOP)  += anatop-mfd.o
   obj-$(CONFIG_MFD_LM3533)  += lm3533-core.o lm3533-ctrlbank.o
  +
  +si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
  +obj-$(CONFIG_MFD_SI476X_CORE) += si476x-core.o
  diff --git a/include/linux/mfd/si476x-core.h 
  b/include/linux/mfd/si476x-core.h
  new file mode 100644
  index 000..eb6f52a
  --- /dev/null
  +++ b/include/linux/mfd/si476x-core.h
  @@ -0,0 +1,529 @@
  +/*
  + * include/media/si476x-core.h -- Common definitions for si476x core
  + * device
  + *
  + * Copyright (C) 2012 Innovative Converged Devices(ICD)
  + *
  + * Author: Andrey Smirnov andrey.smir...@convergeddevices.net
  + *
  + * 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; version 2 of the License.
  + *
  + * 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.
  + *
  + */
  +
  +#ifndef SI476X_CORE_H
  +#define SI476X_CORE_H
  +
  +#include linux/kfifo.h
  +#include linux/atomic.h
  +#include linux/i2c.h
  +#include linux/mutex.h
  +#include linux/mfd/core.h
  +#include linux/videodev2.h
  +
  +#include media/si476x.h
  +
  +#ifdef DEBUG
  +#define DBG_BUFFER(device, header, buffer, bcount)
  \
  +  do {\
  +  dev_info((device), header); \
  +  print_hex_dump_bytes(,\
  +   DUMP_PREFIX_OFFSET,\
  +   buffer, bcount);   \
  +  } while (0)
  +#else
  +#define DBG_BUFFER(device, header, buffer, bcount)
  \
  +  do {} while (0)
  +#endif
  +
  +enum si476x_freq_suppoted_chips {
  typo: suppoted - supported
 
  +  SI476X_CHIP_SI4761 = 1,
  +  SI476X_CHIP_SI4762,
  +  SI476X_CHIP_SI4763,
  +  SI476X_CHIP_SI4764,
  +  SI476X_CHIP_SI4768,
  +  SI476X_CHIP_SI4769,
  +};
  +
  +enum si476x_mfd_cells {
  +  SI476X_RADIO_CELL = 0,
  +  SI476X_CODEC_CELL,
  +  SI476X_MFD_CELLS,
  +};
  +
  +
  +/**
  + * enum si476x_power_state - possible power state of the si476x
  + * device.
  + *
  + * @SI476X_POWER_DOWN: In this state all regulators are turned off
  + * and the reset line is pulled low. The device is completely
  + * inactive.
  + * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
  + * turned on, reset line pulled high, IRQ line is enabled(polling is
  + * active for polling use scenario) and device is turned 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-12-18 Thread Andrey Smirnov

On 12-12-18 11:37 AM, Mauro Carvalho Chehab wrote:

Em Mon, 8 Oct 2012 11:38:01 -0700
Andrey Smirnov andrey.smir...@convergeddevices.net escreveu:


On 10/08/2012 01:43 AM, Hans Verkuil wrote:

On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:

This patch adds all necessary header files and Kbuild plumbing for the
core driver for Silicon Laboratories Si476x series of AM/FM tuner
chips.

The driver as a whole is implemented as an MFD device and this patch
adds a core portion of it that provides all the necessary
functionality to the two other drivers that represent radio and audio
codec subsystems of the chip.

Signed-off-by: Andrey Smirnov andrey.smir...@convergeddevices.net
---
  drivers/mfd/Kconfig |   14 ++
  drivers/mfd/Makefile|3 +
  include/linux/mfd/si476x-core.h |  529 +++
  include/media/si476x.h  |  449 +
  4 files changed, 995 insertions(+)
  create mode 100644 include/linux/mfd/si476x-core.h
  create mode 100644 include/media/si476x.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b1a1462..3fab06d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -895,6 +895,20 @@ config MFD_WL1273_CORE
  driver connects the radio-wl1273 V4L2 module and the wl1273
  audio codec.
  
+config MFD_SI476X_CORE

+   tristate Support for Silicon Laboratories 4761/64/68 AM/FM radio.
+   depends on I2C
+   select MFD_CORE
+   default n
+   help
+ This is the core driver for the SI476x series of AM/FM radio. This MFD
+ driver connects the radio-si476x V4L2 module and the si476x
+ audio codec.
+
+ To compile this driver as a module, choose M here: the
+ module will be called si476x-core.
+
+
  config MFD_OMAP_USB_HOST
bool Support OMAP USBHS core driver
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 79dd22d..942257b 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583)   += rc5t583.o rc5t583-irq.o
  obj-$(CONFIG_MFD_SEC_CORE)+= sec-core.o sec-irq.o
  obj-$(CONFIG_MFD_ANATOP)  += anatop-mfd.o
  obj-$(CONFIG_MFD_LM3533)  += lm3533-core.o lm3533-ctrlbank.o
+
+si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
+obj-$(CONFIG_MFD_SI476X_CORE)  += si476x-core.o
diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h
new file mode 100644
index 000..eb6f52a
--- /dev/null
+++ b/include/linux/mfd/si476x-core.h
@@ -0,0 +1,529 @@
+/*
+ * include/media/si476x-core.h -- Common definitions for si476x core
+ * device
+ *
+ * Copyright (C) 2012 Innovative Converged Devices(ICD)
+ *
+ * Author: Andrey Smirnov andrey.smir...@convergeddevices.net
+ *
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ */
+
+#ifndef SI476X_CORE_H
+#define SI476X_CORE_H
+
+#include linux/kfifo.h
+#include linux/atomic.h
+#include linux/i2c.h
+#include linux/mutex.h
+#include linux/mfd/core.h
+#include linux/videodev2.h
+
+#include media/si476x.h
+
+#ifdef DEBUG
+#define DBG_BUFFER(device, header, buffer, bcount) \
+   do {\
+   dev_info((device), header); \
+   print_hex_dump_bytes(,  \
+DUMP_PREFIX_OFFSET,\
+buffer, bcount);   \
+   } while (0)
+#else
+#define DBG_BUFFER(device, header, buffer, bcount) \
+   do {} while (0)
+#endif
+
+enum si476x_freq_suppoted_chips {

typo: suppoted - supported


+   SI476X_CHIP_SI4761 = 1,
+   SI476X_CHIP_SI4762,
+   SI476X_CHIP_SI4763,
+   SI476X_CHIP_SI4764,
+   SI476X_CHIP_SI4768,
+   SI476X_CHIP_SI4769,
+};
+
+enum si476x_mfd_cells {
+   SI476X_RADIO_CELL = 0,
+   SI476X_CODEC_CELL,
+   SI476X_MFD_CELLS,
+};
+
+
+/**
+ * enum si476x_power_state - possible power state of the si476x
+ * device.
+ *
+ * @SI476X_POWER_DOWN: In this state all regulators are turned off
+ * and the reset line is pulled low. The device is completely
+ * inactive.
+ * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
+ * turned on, reset line pulled high, IRQ line is enabled(polling is
+ * active for polling use scenario) and device is turned on with
+ * POWER_UP command. The device is ready to be used.
+ * 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-10-09 Thread Hans Verkuil
On Mon 8 October 2012 20:38:01 Andrey Smirnov wrote:
> On 10/08/2012 01:43 AM, Hans Verkuil wrote:
> > On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
> >> This patch adds all necessary header files and Kbuild plumbing for the
> >> core driver for Silicon Laboratories Si476x series of AM/FM tuner
> >> chips.
> >>
> >> The driver as a whole is implemented as an MFD device and this patch
> >> adds a core portion of it that provides all the necessary
> >> functionality to the two other drivers that represent radio and audio
> >> codec subsystems of the chip.
> >>
> >> Signed-off-by: Andrey Smirnov 
> >> ---
> >>  drivers/mfd/Kconfig |   14 ++
> >>  drivers/mfd/Makefile|3 +
> >>  include/linux/mfd/si476x-core.h |  529 
> >> +++
> >>  include/media/si476x.h  |  449 +
> >>  4 files changed, 995 insertions(+)
> >>  create mode 100644 include/linux/mfd/si476x-core.h
> >>  create mode 100644 include/media/si476x.h
> >>



> >> diff --git a/include/linux/mfd/si476x-core.h 
> >> b/include/linux/mfd/si476x-core.h
> >> new file mode 100644
> >> index 000..eb6f52a
> >> --- /dev/null
> >> +++ b/include/linux/mfd/si476x-core.h



> >> +#define SI476X_IOC_GET_RSQ_IOWR('V', BASE_VIDIOC_PRIVATE 
> >> + 0, \
> >> +struct si476x_rsq_status_report)
> >> +
> >> +#define SI476X_IOC_SET_PHDIV_MODE _IOW('V', BASE_VIDIOC_PRIVATE + 1, \
> >> +   enum si476x_phase_diversity_mode)
> >> +
> >> +#define SI476X_IOC_GET_PHDIV_STATUS   _IOWR('V', BASE_VIDIOC_PRIVATE 
> >> + 2, \
> >> +int)
> >> +
> >> +#define SI476X_IOC_GET_RSQ_PRIMARY_IOWR('V', BASE_VIDIOC_PRIVATE 
> >> + 3, \
> >> +struct si476x_rsq_status_report)
> >> +
> >> +#define SI476X_IOC_GET_ACF_IOWR('V', BASE_VIDIOC_PRIVATE 
> >> + 4, \
> >> +struct si476x_acf_status_report)
> >> +
> >> +#define SI476X_IOC_GET_AGC_IOWR('V', BASE_VIDIOC_PRIVATE 
> >> + 5, \
> >> +struct si476x_agc_status_report)
> >> +
> >> +#define SI476X_IOC_GET_RDS_BLKCNT _IOWR('V', BASE_VIDIOC_PRIVATE + 6, \
> >> +  struct si476x_rds_blockcount_report)
> > There is no documentation at all for these private ioctls. At the very least
> > these should be documentated (both the ioctl and the structs they receive).
> >
> > More importantly, are these ioctls really needed? 
> 
> I apologize for not writing the documentation for those ioctls. I
> thought I at least did so for all data structures returned by those
> calls, I guess I never got around to doing it. I'll document all the
> ioctls in the next version of the patch.
> 
> SI476X_IOC_SET_PHDIV_MODE, SI476X_IOC_GET_PHDIV_STATUS are definitely
> needed since they are used to control antenna phase diversity modes of
> the tuners. In that mode two Si4764 chips connected to different
> antennas can act as a single tuner and use both signal to improve
> sensibility.

Interesting. But I wonder if this can be implemented as controls? That seems
to me to be a better fit.
 
> The rest is useful to get different radio signal parameters from the
> chip. We used it for during RF performance evaluation of the
> boards(probably using it in EOL testing).
> 
> > If the purpose is to return
> > status information for debugging, then you should consider implementing
> > VIDIOC_LOG_STATUS instead.
> 
> For me, the problem with using VIDIOC_LOG_STATUS is that it dumps all
> the debugging information in kernel log buffer, meaning that if one
> wants to pass that information to some other application they would have
> to resort to screen-scraping of the output of dmesg. Unfortunately the
> people who were using this driver/as a part of a software suite during
> aforementioned RF performance testing are not Linux-savvy enough to be
> asked to use dmesg and they want a GUI solution. That small test utility
> was written and it uses those those ioctls to gather and display all
> signal related information. I guess the other solution for that problem
> would be to create corresponding files in sysfs, but I'm not sure if
> creating multitude of files in sysfs tree is a better option.

Definitely not, although using debugfs might be a good idea.

> Since this version of the driver has not been integrated into our
> software package the we install on laptops to do all the board testing I
> guess I can remove those 'ioctl', but I would love to find acceptable
> solution so that later I would be able to integrate upstream driver int
> our package and not use "special" version of the driver for our purposes.

Can you split off the implementation of these ioctls from the rest of the
driver? And I think you should look into debugfs to see if that isn't a 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-10-09 Thread Hans Verkuil
On Mon 8 October 2012 20:38:01 Andrey Smirnov wrote:
 On 10/08/2012 01:43 AM, Hans Verkuil wrote:
  On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
  This patch adds all necessary header files and Kbuild plumbing for the
  core driver for Silicon Laboratories Si476x series of AM/FM tuner
  chips.
 
  The driver as a whole is implemented as an MFD device and this patch
  adds a core portion of it that provides all the necessary
  functionality to the two other drivers that represent radio and audio
  codec subsystems of the chip.
 
  Signed-off-by: Andrey Smirnov andrey.smir...@convergeddevices.net
  ---
   drivers/mfd/Kconfig |   14 ++
   drivers/mfd/Makefile|3 +
   include/linux/mfd/si476x-core.h |  529 
  +++
   include/media/si476x.h  |  449 +
   4 files changed, 995 insertions(+)
   create mode 100644 include/linux/mfd/si476x-core.h
   create mode 100644 include/media/si476x.h
 

snip

  diff --git a/include/linux/mfd/si476x-core.h 
  b/include/linux/mfd/si476x-core.h
  new file mode 100644
  index 000..eb6f52a
  --- /dev/null
  +++ b/include/linux/mfd/si476x-core.h

snip

  +#define SI476X_IOC_GET_RSQ_IOWR('V', BASE_VIDIOC_PRIVATE 
  + 0, \
  +struct si476x_rsq_status_report)
  +
  +#define SI476X_IOC_SET_PHDIV_MODE _IOW('V', BASE_VIDIOC_PRIVATE + 1, \
  +   enum si476x_phase_diversity_mode)
  +
  +#define SI476X_IOC_GET_PHDIV_STATUS   _IOWR('V', BASE_VIDIOC_PRIVATE 
  + 2, \
  +int)
  +
  +#define SI476X_IOC_GET_RSQ_PRIMARY_IOWR('V', BASE_VIDIOC_PRIVATE 
  + 3, \
  +struct si476x_rsq_status_report)
  +
  +#define SI476X_IOC_GET_ACF_IOWR('V', BASE_VIDIOC_PRIVATE 
  + 4, \
  +struct si476x_acf_status_report)
  +
  +#define SI476X_IOC_GET_AGC_IOWR('V', BASE_VIDIOC_PRIVATE 
  + 5, \
  +struct si476x_agc_status_report)
  +
  +#define SI476X_IOC_GET_RDS_BLKCNT _IOWR('V', BASE_VIDIOC_PRIVATE + 6, \
  +  struct si476x_rds_blockcount_report)
  There is no documentation at all for these private ioctls. At the very least
  these should be documentated (both the ioctl and the structs they receive).
 
  More importantly, are these ioctls really needed? 
 
 I apologize for not writing the documentation for those ioctls. I
 thought I at least did so for all data structures returned by those
 calls, I guess I never got around to doing it. I'll document all the
 ioctls in the next version of the patch.
 
 SI476X_IOC_SET_PHDIV_MODE, SI476X_IOC_GET_PHDIV_STATUS are definitely
 needed since they are used to control antenna phase diversity modes of
 the tuners. In that mode two Si4764 chips connected to different
 antennas can act as a single tuner and use both signal to improve
 sensibility.

Interesting. But I wonder if this can be implemented as controls? That seems
to me to be a better fit.
 
 The rest is useful to get different radio signal parameters from the
 chip. We used it for during RF performance evaluation of the
 boards(probably using it in EOL testing).
 
  If the purpose is to return
  status information for debugging, then you should consider implementing
  VIDIOC_LOG_STATUS instead.
 
 For me, the problem with using VIDIOC_LOG_STATUS is that it dumps all
 the debugging information in kernel log buffer, meaning that if one
 wants to pass that information to some other application they would have
 to resort to screen-scraping of the output of dmesg. Unfortunately the
 people who were using this driver/as a part of a software suite during
 aforementioned RF performance testing are not Linux-savvy enough to be
 asked to use dmesg and they want a GUI solution. That small test utility
 was written and it uses those those ioctls to gather and display all
 signal related information. I guess the other solution for that problem
 would be to create corresponding files in sysfs, but I'm not sure if
 creating multitude of files in sysfs tree is a better option.

Definitely not, although using debugfs might be a good idea.

 Since this version of the driver has not been integrated into our
 software package the we install on laptops to do all the board testing I
 guess I can remove those 'ioctl', but I would love to find acceptable
 solution so that later I would be able to integrate upstream driver int
 our package and not use special version of the driver for our purposes.

Can you split off the implementation of these ioctls from the rest of the
driver? And I think you should look into debugfs to see if that isn't a better
fit then custom ioctls. debugfs has the advantage that you can make changes
later as it isn't considered to be a public API. And this is used primarily
for 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-10-08 Thread Andrey Smirnov
On 10/08/2012 01:43 AM, Hans Verkuil wrote:
> On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
>> This patch adds all necessary header files and Kbuild plumbing for the
>> core driver for Silicon Laboratories Si476x series of AM/FM tuner
>> chips.
>>
>> The driver as a whole is implemented as an MFD device and this patch
>> adds a core portion of it that provides all the necessary
>> functionality to the two other drivers that represent radio and audio
>> codec subsystems of the chip.
>>
>> Signed-off-by: Andrey Smirnov 
>> ---
>>  drivers/mfd/Kconfig |   14 ++
>>  drivers/mfd/Makefile|3 +
>>  include/linux/mfd/si476x-core.h |  529 
>> +++
>>  include/media/si476x.h  |  449 +
>>  4 files changed, 995 insertions(+)
>>  create mode 100644 include/linux/mfd/si476x-core.h
>>  create mode 100644 include/media/si476x.h
>>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index b1a1462..3fab06d 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -895,6 +895,20 @@ config MFD_WL1273_CORE
>>driver connects the radio-wl1273 V4L2 module and the wl1273
>>audio codec.
>>  
>> +config MFD_SI476X_CORE
>> +tristate "Support for Silicon Laboratories 4761/64/68 AM/FM radio."
>> +depends on I2C
>> +select MFD_CORE
>> +default n
>> +help
>> +  This is the core driver for the SI476x series of AM/FM radio. This MFD
>> +  driver connects the radio-si476x V4L2 module and the si476x
>> +  audio codec.
>> +
>> +  To compile this driver as a module, choose M here: the
>> +  module will be called si476x-core.
>> +
>> +
>>  config MFD_OMAP_USB_HOST
>>  bool "Support OMAP USBHS core driver"
>>  depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
>> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
>> index 79dd22d..942257b 100644
>> --- a/drivers/mfd/Makefile
>> +++ b/drivers/mfd/Makefile
>> @@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583)+= rc5t583.o 
>> rc5t583-irq.o
>>  obj-$(CONFIG_MFD_SEC_CORE)  += sec-core.o sec-irq.o
>>  obj-$(CONFIG_MFD_ANATOP)+= anatop-mfd.o
>>  obj-$(CONFIG_MFD_LM3533)+= lm3533-core.o lm3533-ctrlbank.o
>> +
>> +si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
>> +obj-$(CONFIG_MFD_SI476X_CORE)   += si476x-core.o
>> diff --git a/include/linux/mfd/si476x-core.h 
>> b/include/linux/mfd/si476x-core.h
>> new file mode 100644
>> index 000..eb6f52a
>> --- /dev/null
>> +++ b/include/linux/mfd/si476x-core.h
>> @@ -0,0 +1,529 @@
>> +/*
>> + * include/media/si476x-core.h -- Common definitions for si476x core
>> + * device
>> + *
>> + * Copyright (C) 2012 Innovative Converged Devices(ICD)
>> + *
>> + * Author: Andrey Smirnov 
>> + *
>> + * 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; version 2 of the License.
>> + *
>> + * 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.
>> + *
>> + */
>> +
>> +#ifndef SI476X_CORE_H
>> +#define SI476X_CORE_H
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +
>> +#ifdef DEBUG
>> +#define DBG_BUFFER(device, header, buffer, bcount)  \
>> +do {\
>> +dev_info((device), header); \
>> +print_hex_dump_bytes("",\
>> + DUMP_PREFIX_OFFSET,\
>> + buffer, bcount);   \
>> +} while (0)
>> +#else
>> +#define DBG_BUFFER(device, header, buffer, bcount)  \
>> +do {} while (0)
>> +#endif
>> +
>> +enum si476x_freq_suppoted_chips {
> typo: suppoted -> supported
>
>> +SI476X_CHIP_SI4761 = 1,
>> +SI476X_CHIP_SI4762,
>> +SI476X_CHIP_SI4763,
>> +SI476X_CHIP_SI4764,
>> +SI476X_CHIP_SI4768,
>> +SI476X_CHIP_SI4769,
>> +};
>> +
>> +enum si476x_mfd_cells {
>> +SI476X_RADIO_CELL = 0,
>> +SI476X_CODEC_CELL,
>> +SI476X_MFD_CELLS,
>> +};
>> +
>> +
>> +/**
>> + * enum si476x_power_state - possible power state of the si476x
>> + * device.
>> + *
>> + * @SI476X_POWER_DOWN: In this state all regulators are turned off
>> + * and the reset line is pulled low. The device is completely
>> + * inactive.
>> + * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
>> + * turned on, reset line pulled high, IRQ line is enabled(polling is
>> + * active for polling use scenario) and device is turned on with
>> + * POWER_UP command. The device is ready to be used.
>> + * 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-10-08 Thread Hans Verkuil
On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
> This patch adds all necessary header files and Kbuild plumbing for the
> core driver for Silicon Laboratories Si476x series of AM/FM tuner
> chips.
> 
> The driver as a whole is implemented as an MFD device and this patch
> adds a core portion of it that provides all the necessary
> functionality to the two other drivers that represent radio and audio
> codec subsystems of the chip.
> 
> Signed-off-by: Andrey Smirnov 
> ---
>  drivers/mfd/Kconfig |   14 ++
>  drivers/mfd/Makefile|3 +
>  include/linux/mfd/si476x-core.h |  529 
> +++
>  include/media/si476x.h  |  449 +
>  4 files changed, 995 insertions(+)
>  create mode 100644 include/linux/mfd/si476x-core.h
>  create mode 100644 include/media/si476x.h
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index b1a1462..3fab06d 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -895,6 +895,20 @@ config MFD_WL1273_CORE
> driver connects the radio-wl1273 V4L2 module and the wl1273
> audio codec.
>  
> +config MFD_SI476X_CORE
> + tristate "Support for Silicon Laboratories 4761/64/68 AM/FM radio."
> + depends on I2C
> + select MFD_CORE
> + default n
> + help
> +   This is the core driver for the SI476x series of AM/FM radio. This MFD
> +   driver connects the radio-si476x V4L2 module and the si476x
> +   audio codec.
> +
> +   To compile this driver as a module, choose M here: the
> +   module will be called si476x-core.
> +
> +
>  config MFD_OMAP_USB_HOST
>   bool "Support OMAP USBHS core driver"
>   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 79dd22d..942257b 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
>  obj-$(CONFIG_MFD_SEC_CORE)   += sec-core.o sec-irq.o
>  obj-$(CONFIG_MFD_ANATOP) += anatop-mfd.o
>  obj-$(CONFIG_MFD_LM3533) += lm3533-core.o lm3533-ctrlbank.o
> +
> +si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
> +obj-$(CONFIG_MFD_SI476X_CORE)+= si476x-core.o
> diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h
> new file mode 100644
> index 000..eb6f52a
> --- /dev/null
> +++ b/include/linux/mfd/si476x-core.h
> @@ -0,0 +1,529 @@
> +/*
> + * include/media/si476x-core.h -- Common definitions for si476x core
> + * device
> + *
> + * Copyright (C) 2012 Innovative Converged Devices(ICD)
> + *
> + * Author: Andrey Smirnov 
> + *
> + * 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; version 2 of the License.
> + *
> + * 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.
> + *
> + */
> +
> +#ifndef SI476X_CORE_H
> +#define SI476X_CORE_H
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#ifdef DEBUG
> +#define DBG_BUFFER(device, header, buffer, bcount)   \
> + do {\
> + dev_info((device), header); \
> + print_hex_dump_bytes("",\
> +  DUMP_PREFIX_OFFSET,\
> +  buffer, bcount);   \
> + } while (0)
> +#else
> +#define DBG_BUFFER(device, header, buffer, bcount)   \
> + do {} while (0)
> +#endif
> +
> +enum si476x_freq_suppoted_chips {

typo: suppoted -> supported

> + SI476X_CHIP_SI4761 = 1,
> + SI476X_CHIP_SI4762,
> + SI476X_CHIP_SI4763,
> + SI476X_CHIP_SI4764,
> + SI476X_CHIP_SI4768,
> + SI476X_CHIP_SI4769,
> +};
> +
> +enum si476x_mfd_cells {
> + SI476X_RADIO_CELL = 0,
> + SI476X_CODEC_CELL,
> + SI476X_MFD_CELLS,
> +};
> +
> +
> +/**
> + * enum si476x_power_state - possible power state of the si476x
> + * device.
> + *
> + * @SI476X_POWER_DOWN: In this state all regulators are turned off
> + * and the reset line is pulled low. The device is completely
> + * inactive.
> + * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
> + * turned on, reset line pulled high, IRQ line is enabled(polling is
> + * active for polling use scenario) and device is turned on with
> + * POWER_UP command. The device is ready to be used.
> + * @SI476X_POWER_INCONSISTENT: This state indicates that previous
> + * power down was inconsisten meaning some of he regulators wer not
> + * turned down and thus the 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-10-08 Thread Hans Verkuil
On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
 This patch adds all necessary header files and Kbuild plumbing for the
 core driver for Silicon Laboratories Si476x series of AM/FM tuner
 chips.
 
 The driver as a whole is implemented as an MFD device and this patch
 adds a core portion of it that provides all the necessary
 functionality to the two other drivers that represent radio and audio
 codec subsystems of the chip.
 
 Signed-off-by: Andrey Smirnov andrey.smir...@convergeddevices.net
 ---
  drivers/mfd/Kconfig |   14 ++
  drivers/mfd/Makefile|3 +
  include/linux/mfd/si476x-core.h |  529 
 +++
  include/media/si476x.h  |  449 +
  4 files changed, 995 insertions(+)
  create mode 100644 include/linux/mfd/si476x-core.h
  create mode 100644 include/media/si476x.h
 
 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index b1a1462..3fab06d 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -895,6 +895,20 @@ config MFD_WL1273_CORE
 driver connects the radio-wl1273 V4L2 module and the wl1273
 audio codec.
  
 +config MFD_SI476X_CORE
 + tristate Support for Silicon Laboratories 4761/64/68 AM/FM radio.
 + depends on I2C
 + select MFD_CORE
 + default n
 + help
 +   This is the core driver for the SI476x series of AM/FM radio. This MFD
 +   driver connects the radio-si476x V4L2 module and the si476x
 +   audio codec.
 +
 +   To compile this driver as a module, choose M here: the
 +   module will be called si476x-core.
 +
 +
  config MFD_OMAP_USB_HOST
   bool Support OMAP USBHS core driver
   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
 index 79dd22d..942257b 100644
 --- a/drivers/mfd/Makefile
 +++ b/drivers/mfd/Makefile
 @@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
  obj-$(CONFIG_MFD_SEC_CORE)   += sec-core.o sec-irq.o
  obj-$(CONFIG_MFD_ANATOP) += anatop-mfd.o
  obj-$(CONFIG_MFD_LM3533) += lm3533-core.o lm3533-ctrlbank.o
 +
 +si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
 +obj-$(CONFIG_MFD_SI476X_CORE)+= si476x-core.o
 diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h
 new file mode 100644
 index 000..eb6f52a
 --- /dev/null
 +++ b/include/linux/mfd/si476x-core.h
 @@ -0,0 +1,529 @@
 +/*
 + * include/media/si476x-core.h -- Common definitions for si476x core
 + * device
 + *
 + * Copyright (C) 2012 Innovative Converged Devices(ICD)
 + *
 + * Author: Andrey Smirnov andrey.smir...@convergeddevices.net
 + *
 + * 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; version 2 of the License.
 + *
 + * 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.
 + *
 + */
 +
 +#ifndef SI476X_CORE_H
 +#define SI476X_CORE_H
 +
 +#include linux/kfifo.h
 +#include linux/atomic.h
 +#include linux/i2c.h
 +#include linux/mutex.h
 +#include linux/mfd/core.h
 +#include linux/videodev2.h
 +
 +#include media/si476x.h
 +
 +#ifdef DEBUG
 +#define DBG_BUFFER(device, header, buffer, bcount)   \
 + do {\
 + dev_info((device), header); \
 + print_hex_dump_bytes(,\
 +  DUMP_PREFIX_OFFSET,\
 +  buffer, bcount);   \
 + } while (0)
 +#else
 +#define DBG_BUFFER(device, header, buffer, bcount)   \
 + do {} while (0)
 +#endif
 +
 +enum si476x_freq_suppoted_chips {

typo: suppoted - supported

 + SI476X_CHIP_SI4761 = 1,
 + SI476X_CHIP_SI4762,
 + SI476X_CHIP_SI4763,
 + SI476X_CHIP_SI4764,
 + SI476X_CHIP_SI4768,
 + SI476X_CHIP_SI4769,
 +};
 +
 +enum si476x_mfd_cells {
 + SI476X_RADIO_CELL = 0,
 + SI476X_CODEC_CELL,
 + SI476X_MFD_CELLS,
 +};
 +
 +
 +/**
 + * enum si476x_power_state - possible power state of the si476x
 + * device.
 + *
 + * @SI476X_POWER_DOWN: In this state all regulators are turned off
 + * and the reset line is pulled low. The device is completely
 + * inactive.
 + * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
 + * turned on, reset line pulled high, IRQ line is enabled(polling is
 + * active for polling use scenario) and device is turned on with
 + * POWER_UP command. The device is ready to be used.
 + * @SI476X_POWER_INCONSISTENT: This state indicates that previous
 + * power down was inconsisten meaning some of he regulators wer not
 + * 

Re: [PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-10-08 Thread Andrey Smirnov
On 10/08/2012 01:43 AM, Hans Verkuil wrote:
 On Sat October 6 2012 03:54:57 Andrey Smirnov wrote:
 This patch adds all necessary header files and Kbuild plumbing for the
 core driver for Silicon Laboratories Si476x series of AM/FM tuner
 chips.

 The driver as a whole is implemented as an MFD device and this patch
 adds a core portion of it that provides all the necessary
 functionality to the two other drivers that represent radio and audio
 codec subsystems of the chip.

 Signed-off-by: Andrey Smirnov andrey.smir...@convergeddevices.net
 ---
  drivers/mfd/Kconfig |   14 ++
  drivers/mfd/Makefile|3 +
  include/linux/mfd/si476x-core.h |  529 
 +++
  include/media/si476x.h  |  449 +
  4 files changed, 995 insertions(+)
  create mode 100644 include/linux/mfd/si476x-core.h
  create mode 100644 include/media/si476x.h

 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index b1a1462..3fab06d 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -895,6 +895,20 @@ config MFD_WL1273_CORE
driver connects the radio-wl1273 V4L2 module and the wl1273
audio codec.
  
 +config MFD_SI476X_CORE
 +tristate Support for Silicon Laboratories 4761/64/68 AM/FM radio.
 +depends on I2C
 +select MFD_CORE
 +default n
 +help
 +  This is the core driver for the SI476x series of AM/FM radio. This MFD
 +  driver connects the radio-si476x V4L2 module and the si476x
 +  audio codec.
 +
 +  To compile this driver as a module, choose M here: the
 +  module will be called si476x-core.
 +
 +
  config MFD_OMAP_USB_HOST
  bool Support OMAP USBHS core driver
  depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
 index 79dd22d..942257b 100644
 --- a/drivers/mfd/Makefile
 +++ b/drivers/mfd/Makefile
 @@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583)+= rc5t583.o 
 rc5t583-irq.o
  obj-$(CONFIG_MFD_SEC_CORE)  += sec-core.o sec-irq.o
  obj-$(CONFIG_MFD_ANATOP)+= anatop-mfd.o
  obj-$(CONFIG_MFD_LM3533)+= lm3533-core.o lm3533-ctrlbank.o
 +
 +si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
 +obj-$(CONFIG_MFD_SI476X_CORE)   += si476x-core.o
 diff --git a/include/linux/mfd/si476x-core.h 
 b/include/linux/mfd/si476x-core.h
 new file mode 100644
 index 000..eb6f52a
 --- /dev/null
 +++ b/include/linux/mfd/si476x-core.h
 @@ -0,0 +1,529 @@
 +/*
 + * include/media/si476x-core.h -- Common definitions for si476x core
 + * device
 + *
 + * Copyright (C) 2012 Innovative Converged Devices(ICD)
 + *
 + * Author: Andrey Smirnov andrey.smir...@convergeddevices.net
 + *
 + * 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; version 2 of the License.
 + *
 + * 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.
 + *
 + */
 +
 +#ifndef SI476X_CORE_H
 +#define SI476X_CORE_H
 +
 +#include linux/kfifo.h
 +#include linux/atomic.h
 +#include linux/i2c.h
 +#include linux/mutex.h
 +#include linux/mfd/core.h
 +#include linux/videodev2.h
 +
 +#include media/si476x.h
 +
 +#ifdef DEBUG
 +#define DBG_BUFFER(device, header, buffer, bcount)  \
 +do {\
 +dev_info((device), header); \
 +print_hex_dump_bytes(,\
 + DUMP_PREFIX_OFFSET,\
 + buffer, bcount);   \
 +} while (0)
 +#else
 +#define DBG_BUFFER(device, header, buffer, bcount)  \
 +do {} while (0)
 +#endif
 +
 +enum si476x_freq_suppoted_chips {
 typo: suppoted - supported

 +SI476X_CHIP_SI4761 = 1,
 +SI476X_CHIP_SI4762,
 +SI476X_CHIP_SI4763,
 +SI476X_CHIP_SI4764,
 +SI476X_CHIP_SI4768,
 +SI476X_CHIP_SI4769,
 +};
 +
 +enum si476x_mfd_cells {
 +SI476X_RADIO_CELL = 0,
 +SI476X_CODEC_CELL,
 +SI476X_MFD_CELLS,
 +};
 +
 +
 +/**
 + * enum si476x_power_state - possible power state of the si476x
 + * device.
 + *
 + * @SI476X_POWER_DOWN: In this state all regulators are turned off
 + * and the reset line is pulled low. The device is completely
 + * inactive.
 + * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
 + * turned on, reset line pulled high, IRQ line is enabled(polling is
 + * active for polling use scenario) and device is turned on with
 + * POWER_UP command. The device is ready to be used.
 + * @SI476X_POWER_INCONSISTENT: This state indicates that previous
 + * power down was inconsisten meaning some of he 

[PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-10-05 Thread Andrey Smirnov
This patch adds all necessary header files and Kbuild plumbing for the
core driver for Silicon Laboratories Si476x series of AM/FM tuner
chips.

The driver as a whole is implemented as an MFD device and this patch
adds a core portion of it that provides all the necessary
functionality to the two other drivers that represent radio and audio
codec subsystems of the chip.

Signed-off-by: Andrey Smirnov 
---
 drivers/mfd/Kconfig |   14 ++
 drivers/mfd/Makefile|3 +
 include/linux/mfd/si476x-core.h |  529 +++
 include/media/si476x.h  |  449 +
 4 files changed, 995 insertions(+)
 create mode 100644 include/linux/mfd/si476x-core.h
 create mode 100644 include/media/si476x.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b1a1462..3fab06d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -895,6 +895,20 @@ config MFD_WL1273_CORE
  driver connects the radio-wl1273 V4L2 module and the wl1273
  audio codec.
 
+config MFD_SI476X_CORE
+   tristate "Support for Silicon Laboratories 4761/64/68 AM/FM radio."
+   depends on I2C
+   select MFD_CORE
+   default n
+   help
+ This is the core driver for the SI476x series of AM/FM radio. This MFD
+ driver connects the radio-si476x V4L2 module and the si476x
+ audio codec.
+
+ To compile this driver as a module, choose M here: the
+ module will be called si476x-core.
+
+
 config MFD_OMAP_USB_HOST
bool "Support OMAP USBHS core driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 79dd22d..942257b 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583)   += rc5t583.o rc5t583-irq.o
 obj-$(CONFIG_MFD_SEC_CORE) += sec-core.o sec-irq.o
 obj-$(CONFIG_MFD_ANATOP)   += anatop-mfd.o
 obj-$(CONFIG_MFD_LM3533)   += lm3533-core.o lm3533-ctrlbank.o
+
+si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
+obj-$(CONFIG_MFD_SI476X_CORE)  += si476x-core.o
diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h
new file mode 100644
index 000..eb6f52a
--- /dev/null
+++ b/include/linux/mfd/si476x-core.h
@@ -0,0 +1,529 @@
+/*
+ * include/media/si476x-core.h -- Common definitions for si476x core
+ * device
+ *
+ * Copyright (C) 2012 Innovative Converged Devices(ICD)
+ *
+ * Author: Andrey Smirnov 
+ *
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ */
+
+#ifndef SI476X_CORE_H
+#define SI476X_CORE_H
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#ifdef DEBUG
+#define DBG_BUFFER(device, header, buffer, bcount) \
+   do {\
+   dev_info((device), header); \
+   print_hex_dump_bytes("",\
+DUMP_PREFIX_OFFSET,\
+buffer, bcount);   \
+   } while (0)
+#else
+#define DBG_BUFFER(device, header, buffer, bcount) \
+   do {} while (0)
+#endif
+
+enum si476x_freq_suppoted_chips {
+   SI476X_CHIP_SI4761 = 1,
+   SI476X_CHIP_SI4762,
+   SI476X_CHIP_SI4763,
+   SI476X_CHIP_SI4764,
+   SI476X_CHIP_SI4768,
+   SI476X_CHIP_SI4769,
+};
+
+enum si476x_mfd_cells {
+   SI476X_RADIO_CELL = 0,
+   SI476X_CODEC_CELL,
+   SI476X_MFD_CELLS,
+};
+
+
+/**
+ * enum si476x_power_state - possible power state of the si476x
+ * device.
+ *
+ * @SI476X_POWER_DOWN: In this state all regulators are turned off
+ * and the reset line is pulled low. The device is completely
+ * inactive.
+ * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
+ * turned on, reset line pulled high, IRQ line is enabled(polling is
+ * active for polling use scenario) and device is turned on with
+ * POWER_UP command. The device is ready to be used.
+ * @SI476X_POWER_INCONSISTENT: This state indicates that previous
+ * power down was inconsisten meaning some of he regulators wer not
+ * turned down and thus the consequent use of the device, without
+ * power-cycling it is impossible.
+ */
+enum si476x_power_state {
+   SI476X_POWER_DOWN   = 0,
+   SI476X_POWER_UP_FULL= 1,
+   SI476X_POWER_INCONSISTENT   = 2,
+};
+
+/**
+ * struct si476x_core - internal data 

[PATCH v2 1/6] Add header files and Kbuild plumbing for SI476x MFD core

2012-10-05 Thread Andrey Smirnov
This patch adds all necessary header files and Kbuild plumbing for the
core driver for Silicon Laboratories Si476x series of AM/FM tuner
chips.

The driver as a whole is implemented as an MFD device and this patch
adds a core portion of it that provides all the necessary
functionality to the two other drivers that represent radio and audio
codec subsystems of the chip.

Signed-off-by: Andrey Smirnov andrey.smir...@convergeddevices.net
---
 drivers/mfd/Kconfig |   14 ++
 drivers/mfd/Makefile|3 +
 include/linux/mfd/si476x-core.h |  529 +++
 include/media/si476x.h  |  449 +
 4 files changed, 995 insertions(+)
 create mode 100644 include/linux/mfd/si476x-core.h
 create mode 100644 include/media/si476x.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b1a1462..3fab06d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -895,6 +895,20 @@ config MFD_WL1273_CORE
  driver connects the radio-wl1273 V4L2 module and the wl1273
  audio codec.
 
+config MFD_SI476X_CORE
+   tristate Support for Silicon Laboratories 4761/64/68 AM/FM radio.
+   depends on I2C
+   select MFD_CORE
+   default n
+   help
+ This is the core driver for the SI476x series of AM/FM radio. This MFD
+ driver connects the radio-si476x V4L2 module and the si476x
+ audio codec.
+
+ To compile this driver as a module, choose M here: the
+ module will be called si476x-core.
+
+
 config MFD_OMAP_USB_HOST
bool Support OMAP USBHS core driver
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 79dd22d..942257b 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -132,3 +132,6 @@ obj-$(CONFIG_MFD_RC5T583)   += rc5t583.o rc5t583-irq.o
 obj-$(CONFIG_MFD_SEC_CORE) += sec-core.o sec-irq.o
 obj-$(CONFIG_MFD_ANATOP)   += anatop-mfd.o
 obj-$(CONFIG_MFD_LM3533)   += lm3533-core.o lm3533-ctrlbank.o
+
+si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
+obj-$(CONFIG_MFD_SI476X_CORE)  += si476x-core.o
diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h
new file mode 100644
index 000..eb6f52a
--- /dev/null
+++ b/include/linux/mfd/si476x-core.h
@@ -0,0 +1,529 @@
+/*
+ * include/media/si476x-core.h -- Common definitions for si476x core
+ * device
+ *
+ * Copyright (C) 2012 Innovative Converged Devices(ICD)
+ *
+ * Author: Andrey Smirnov andrey.smir...@convergeddevices.net
+ *
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ */
+
+#ifndef SI476X_CORE_H
+#define SI476X_CORE_H
+
+#include linux/kfifo.h
+#include linux/atomic.h
+#include linux/i2c.h
+#include linux/mutex.h
+#include linux/mfd/core.h
+#include linux/videodev2.h
+
+#include media/si476x.h
+
+#ifdef DEBUG
+#define DBG_BUFFER(device, header, buffer, bcount) \
+   do {\
+   dev_info((device), header); \
+   print_hex_dump_bytes(,\
+DUMP_PREFIX_OFFSET,\
+buffer, bcount);   \
+   } while (0)
+#else
+#define DBG_BUFFER(device, header, buffer, bcount) \
+   do {} while (0)
+#endif
+
+enum si476x_freq_suppoted_chips {
+   SI476X_CHIP_SI4761 = 1,
+   SI476X_CHIP_SI4762,
+   SI476X_CHIP_SI4763,
+   SI476X_CHIP_SI4764,
+   SI476X_CHIP_SI4768,
+   SI476X_CHIP_SI4769,
+};
+
+enum si476x_mfd_cells {
+   SI476X_RADIO_CELL = 0,
+   SI476X_CODEC_CELL,
+   SI476X_MFD_CELLS,
+};
+
+
+/**
+ * enum si476x_power_state - possible power state of the si476x
+ * device.
+ *
+ * @SI476X_POWER_DOWN: In this state all regulators are turned off
+ * and the reset line is pulled low. The device is completely
+ * inactive.
+ * @SI476X_POWER_UP_FULL: In this state all the power regualtors are
+ * turned on, reset line pulled high, IRQ line is enabled(polling is
+ * active for polling use scenario) and device is turned on with
+ * POWER_UP command. The device is ready to be used.
+ * @SI476X_POWER_INCONSISTENT: This state indicates that previous
+ * power down was inconsisten meaning some of he regulators wer not
+ * turned down and thus the consequent use of the device, without
+ * power-cycling it is impossible.
+ */
+enum si476x_power_state {
+