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

2012-10-23 Thread Joe Perches
On Tue, 2012-10-23 at 11:44 -0700, 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.

[]

> +#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)

maybe just:
dev_dbg(device, whatever_fmt ": %*ph\n", bcount, buffer);
at each call site


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2012-10-23 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 |  539 +++
 include/media/si476x.h  |  427 +++
 4 files changed, 983 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..08bc5dd
--- /dev/null
+++ b/include/linux/mfd/si476x-core.h
@@ -0,0 +1,539 @@
+/*
+ * 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 
+#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
+
+/*  si476x-i2c.c --- */
+
+enum si476x_freq_supported_chips {
+   SI476X_CHIP_SI4761 = 1,
+   SI476X_CHIP_SI4764,
+   SI476X_CHIP_SI4768,
+};
+
+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 inconsistent, meaning some of the regulators were
+ * not turned down and thus use of the device, without power-cycling
+ * is impossible.
+ */
+enum si476x_power_state {
+   SI476X_POWER_DOWN   = 0,
+   SI476X_POWER_UP_FULL= 1,
+   SI476X_POWER_INCONSISTENT   = 2,
+};
+
+/**
+ * struct si476x_core - internal data structure 

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

2012-10-23 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 |  539 +++
 include/media/si476x.h  |  427 +++
 4 files changed, 983 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..08bc5dd
--- /dev/null
+++ b/include/linux/mfd/si476x-core.h
@@ -0,0 +1,539 @@
+/*
+ * 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/regmap.h
+#include linux/mutex.h
+#include linux/mfd/core.h
+#include linux/videodev2.h
+#include linux/regulator/consumer.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
+
+/*  si476x-i2c.c --- */
+
+enum si476x_freq_supported_chips {
+   SI476X_CHIP_SI4761 = 1,
+   SI476X_CHIP_SI4764,
+   SI476X_CHIP_SI4768,
+};
+
+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 inconsistent, meaning some of the regulators were
+ * not turned down and thus use of the device, without power-cycling
+ * is impossible.
+ */
+enum 

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

2012-10-23 Thread Joe Perches
On Tue, 2012-10-23 at 11:44 -0700, 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.

[]

 +#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)

maybe just:
dev_dbg(device, whatever_fmt : %*ph\n, bcount, buffer);
at each call site


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/