Re: DVB_T2 Multistream support (PLP)

2013-02-18 Thread Michael Stilmant
On Sat, Feb 16, 2013 at 8:57 AM, Manu Abraham abraham.m...@gmail.com wrote:
 At least, according to Sony: the CXD2820 chipset maker (hardware) doesn't
 support multiple PLP's.

Ho!? I don't well understand
Is it because you mention CXD2820 and not CXD2820R?
because Sony spec
http://www.sony.net/Products/SC-HP/cx_news/vol60/pdf/cxd2820r.pdf
mention Supports Multiple-PLP
And there
The CXD2820R conforms to DTG400, DTG401, DTG402, DTG403, DTG404 and
other parameters.
Where I don't know what DTGxxx.

Regards,

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


[PATCH v4] media: ths7353: add support for ths7353 video amplifier

2013-02-18 Thread Prabhakar lad
From: Lad, Prabhakar prabhakar@ti.com

The patch adds support for THS7353 video amplifier.
The the THS7353 amplifier is very much similar to the
existing THS7303 video amplifier driver.
This patch appropriately makes changes to the existing
ths7303 driver and adds support for the THS7353.
This patch also adds V4L2_IDENT_THS7353 for the THS7353
chip and appropriate changes to Kconfig file for building.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Signed-off-by: Martin Bugge marbu...@cisco.com
Cc: Chaithrika U S chaithr...@ti.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 Changes for v4:
 1: Fixed review comments pointed out by Mauro.

 Changes for v3:
 1: Fixed review comments pointed out by Hans.

 Changes for v2:
 1: Merged the driver in existing ths7303 driver.
 2: Merged the patch which adds the chip indent in same patch.

 drivers/media/i2c/Kconfig   |6 +-
 drivers/media/i2c/ths7303.c |  351 ---
 include/media/ths7303.h |   42 +
 include/media/v4l2-chip-ident.h |3 +
 4 files changed, 340 insertions(+), 62 deletions(-)
 create mode 100644 include/media/ths7303.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 7b771ba..ec07ceb 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -550,10 +550,10 @@ config VIDEO_UPD64083
 comment Miscelaneous helper chips
 
 config VIDEO_THS7303
-   tristate THS7303 Video Amplifier
-   depends on I2C
+   tristate THS7303/53 Video Amplifier
+   depends on VIDEO_V4L2  I2C
help
- Support for TI THS7303 video amplifier
+ Support for TI THS7303/53 video amplifier
 
  To compile this driver as a module, choose M here: the
  module will be called ths7303.
diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c
index e747524..3ca60c7 100644
--- a/drivers/media/i2c/ths7303.c
+++ b/drivers/media/i2c/ths7303.c
@@ -1,7 +1,15 @@
 /*
- * ths7303- THS7303 Video Amplifier driver
+ * ths7303/53- THS7303/53 Video Amplifier driver
  *
  * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
+ * Copyright 2013 Cisco Systems, Inc. and/or its affiliates.
+ *
+ * Author: Chaithrika U S chaithr...@ti.com
+ *
+ * Contributors:
+ * Hans Verkuil hans.verk...@cisco.com
+ * Lad, Prabhakar prabhakar@ti.com
+ * Martin Bugge marbu...@cisco.com
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -13,25 +21,27 @@
  * GNU General Public License for more details.
  */
 
-#include linux/kernel.h
-#include linux/init.h
-#include linux/ctype.h
-#include linux/slab.h
 #include linux/i2c.h
-#include linux/device.h
-#include linux/delay.h
 #include linux/module.h
-#include linux/uaccess.h
-#include linux/videodev2.h
+#include linux/slab.h
 
-#include media/v4l2-device.h
-#include media/v4l2-subdev.h
+#include media/ths7303.h
 #include media/v4l2-chip-ident.h
+#include media/v4l2-device.h
 
 #define THS7303_CHANNEL_1  1
 #define THS7303_CHANNEL_2  2
 #define THS7303_CHANNEL_3  3
 
+struct ths7303_state {
+   struct v4l2_subdev  sd;
+   struct ths7303_platform_datapdata;
+   struct v4l2_bt_timings  bt;
+   int std_id;
+   int stream_on;
+   int driver_data;
+};
+
 enum ths7303_filter_mode {
THS7303_FILTER_MODE_480I_576I,
THS7303_FILTER_MODE_480P_576P,
@@ -48,64 +58,84 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, Debug level 0-1);
 
+static inline struct ths7303_state *to_state(struct v4l2_subdev *sd)
+{
+   return container_of(sd, struct ths7303_state, sd);
+}
+
+static int ths7303_read(struct v4l2_subdev *sd, u8 reg)
+{
+   struct i2c_client *client = v4l2_get_subdevdata(sd);
+
+   return i2c_smbus_read_byte_data(client, reg);
+}
+
+static int ths7303_write(struct v4l2_subdev *sd, u8 reg, u8 val)
+{
+   struct i2c_client *client = v4l2_get_subdevdata(sd);
+   int ret;
+   int i;
+
+   for (i = 0; i  3; i++) {
+   ret = i2c_smbus_write_byte_data(client, reg, val);
+   if (ret == 0)
+   return 0;
+   }
+   return ret;
+}
+
 /* following function is used to set ths7303 */
 int ths7303_setval(struct v4l2_subdev *sd, enum ths7303_filter_mode mode)
 {
-   u8 input_bias_chroma = 3;
-   u8 input_bias_luma = 3;
-   int disable = 0;
-   int err = 0;
-   u8 val = 0;
-   u8 temp;
-
struct i2c_client *client = v4l2_get_subdevdata(sd);
+   struct ths7303_state *state = to_state(sd);
+   struct ths7303_platform_data *pdata = state-pdata;
+   u8 val, sel = 0;
+   int err, disable = 0;
 
if (!client)
return -EINVAL;
 
switch (mode) {
case THS7303_FILTER_MODE_1080P:
-   val = (3  

Re: [PATCH v17 2/7] video: add display_timing and videomode

2013-02-18 Thread Tomi Valkeinen
Hi Steffen,

On 2013-01-25 11:01, Steffen Trumtrar wrote:

 +/* VESA display monitor timing parameters */
 +#define VESA_DMT_HSYNC_LOW   BIT(0)
 +#define VESA_DMT_HSYNC_HIGH  BIT(1)
 +#define VESA_DMT_VSYNC_LOW   BIT(2)
 +#define VESA_DMT_VSYNC_HIGH  BIT(3)
 +
 +/* display specific flags */
 +#define DISPLAY_FLAGS_DE_LOW BIT(0)  /* data enable flag */
 +#define DISPLAY_FLAGS_DE_HIGHBIT(1)
 +#define DISPLAY_FLAGS_PIXDATA_POSEDGEBIT(2)  /* drive data on pos. 
 edge */
 +#define DISPLAY_FLAGS_PIXDATA_NEGEDGEBIT(3)  /* drive data on neg. 
 edge */
 +#define DISPLAY_FLAGS_INTERLACED BIT(4)
 +#define DISPLAY_FLAGS_DOUBLESCAN BIT(5)

snip

 + unsigned int dmt_flags; /* VESA DMT flags */
 + unsigned int data_flags; /* video data flags */

Why did you go for this approach? To be able to represent
true/false/not-specified?

Would it be simpler to just have flags field? What does it give us to
have those two separately?

Should the above say raising edge/falling edge instead of positive
edge/negative edge?

 Tomi

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


DVB-T

2013-02-18 Thread dvb-t . portugal

Hello.

I am sending the file for DVB-T in Portugal (excluding Madeira and  
Azores) retrieved at Lisbon.
# DVB-T Lisbon, Portugal - TDT Continente
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # RTP 1
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # RTP 2
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # SIC
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # TVI
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # ARTV
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # HD


DVB-T (plaintext)

2013-02-18 Thread dvb-t . portugal


# DVB-T Lisbon, Portugal - TDT Continente
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # RTP 1
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # RTP 2
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # SIC
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # TVI
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # ARTV
T 75400 8MHz 2/3 NONE QAM_64 8k 1/4 NONE # HD
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: DVB-T

2013-02-18 Thread Oliver Schinagl

I'd be happy to apply it (even confirt it to a patch for you ;)

but two things that I notice:

I think you listed the same transponder 6 times (with the channels in 
the comments).


One transponder for all channels on that transponder is enough ;)

While google (translating) any info on portugal DVB-T I found the 
following (translated link)


http://translate.google.com/translate?sl=pttl=enjs=nprev=_thl=enie=UTF-8eotf=1u=http%3A%2F%2Ftdt.telecom.pt%2Fquando%2F

A snipped:
 (ask the shop because your equipment must be compatible with the DVB-T 
technology and MPEG-4/H.264 with the standard.)


So is this DVB-T2? Is this DVB-T1 with MPEG-4 over it? (Is that called 
dvb-t2 aswell?)


If you can answer these question, i'll push your changes.

On 02/18/13 16:43, dvb-t.portu...@sapo.pt wrote:

Hello.

I am sending the file for DVB-T in Portugal (excluding Madeira and
Azores) retrieved at Lisbon.


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


Re: DVB-T

2013-02-18 Thread Oliver Schinagl

I'd be happy to apply it (even confirt it to a patch for you ;)

but two things that I notice:

I think you listed the same transponder 6 times (with the channels in 
the comments).


One transponder for all channels on that transponder is enough ;)

While google (translating) any info on portugal DVB-T I found the 
following (translated link)


http://translate.google.com/translate?sl=pttl=enjs=nprev=_thl=enie=UTF-8eotf=1u=http%3A%2F%2Ftdt.telecom.pt%2Fquando%2F

A snipped:
 (ask the shop because your equipment must be compatible with the DVB-T 
technology and MPEG-4/H.264 with the standard.)


So is this DVB-T2? Is this DVB-T1 with MPEG-4 over it? (Is that called 
dvb-t2 aswell?)


If you can answer these question, i'll push your changes.

On 02/18/13 16:43, dvb-t.portu...@sapo.pt wrote:

Hello.

I am sending the file for DVB-T in Portugal (excluding Madeira and
Azores) retrieved at Lisbon.


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


Wrongly identified easycap em28xx

2013-02-18 Thread Mr Goldcove
Easy Cap DC-60++
Wrongly identified as card 19 EM2860/SAA711X Reference Design,
resulting in no audio.
Works perfectly when using card 64 Easy Cap Capture DC-60

**Interim solution**
load module (before inserting the EasyCap. I'm having trouble if the
module is loaded/unloaded with different cards...)
modprobe em28xx card=64
  or
add options em28xx card=64 to /etc/modprobe.d/local.conf

**hw info**
Bus 002 Device 005: ID eb1a:2861 eMPIA Technology, Inc.

Chips:
Empia EM2860 P7JY8-011 201023-01AG
NXP SAA7113H
RMC ALC653 89G06K1 G909A

**logs**
[ 5567.367883] em28xx: New device @ 480 Mbps (eb1a:2861, interface 0,
class 0)
[ 5567.367985] em28xx #0: chip ID is em2860
[ 5567.380645] IR MCE Keyboard/mouse protocol handler initialized
[ 5567.384202] lirc_dev: IR Remote Control driver registered, major 249
[ 5567.385468] IR LIRC bridge handler initialized
[ 5567.460386] em28xx #0: board has no eeprom
[ 5567.534612] em28xx #0: found i2c device @ 0x4a [saa7113h]
[ 5567.568303] em28xx #0: Your board has no unique USB ID.
[ 5567.568308] em28xx #0: A hint were successfully done, based on i2c
devicelist hash.
[ 5567.568312] em28xx #0: This method is not 100% failproof.
[ 5567.568314] em28xx #0: If the board were missdetected, please email
this log to:
[ 5567.568317] em28xx #0: V4L Mailing List 
linux-media@vger.kernel.org
[ 5567.568321] em28xx #0: Board detected as EM2860/SAA711X Reference Design
[ 5567.647433] em28xx #0: Identified as EM2860/SAA711X Reference Design
(card=19)
[ 5567.647438] em28xx #0: Registering snapshot button...
[ 5567.647531] input: em28xx snapshot button as
/devices/pci:00/:00:1d.0/usb2/2-1/2-1.4/input/input11
[ 5568.019310] saa7115 15-0025: saa7113 found (1f7113d0e10) @ 0x4a
(em28xx #0)
[ 5568.789385] em28xx #0: Config register raw data: 0x10
[ 5568.813055] em28xx #0: AC97 vendor ID = 0x414c4761
[ 5568.825074] em28xx #0: AC97 features = 0x
[ 5568.825078] em28xx #0: Unknown AC97 audio processor detected!
[ 5569.284137] em28xx #0: v4l2 driver version 0.1.3
[ 5570.305831] em28xx #0: V4L2 video device registered as video1
[ 5570.305835] em28xx #0: V4L2 VBI device registered as vbi0
[ 5570.305862] em28xx audio device (eb1a:2861): interface 1, class 1
[ 5570.305877] em28xx audio device (eb1a:2861): interface 2, class 1
[ 5570.305906] usbcore: registered new interface driver em28xx
[ 5570.305909] em28xx driver loaded
[ 5570.392917] usbcore: registered new interface driver snd-usb-audio
[ 7903.785365] em28xx #0: vidioc_s_fmt_vid_cap queue busy
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: ERRORS

2013-02-18 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Mon Feb 18 19:00:18 CET 2013
git branch: for_v3.9
git hash:   ed72d37a33fdf43dc47787fe220532cdec9da528
gcc version:i686-linux-gcc (GCC) 4.7.2
host hardware:  x86_64
host os:3.8.03-marune

linux-git-arm-davinci: WARNINGS
linux-git-arm-exynos: ERRORS
linux-git-arm-omap: WARNINGS
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: WARNINGS
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: WARNINGS
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-rc4-i686: OK
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-rc4-x86_64: WARNINGS
apps: WARNINGS
spec-git: OK
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Wrongly identified easycap em28xx

2013-02-18 Thread Frank Schäfer
Am 18.02.2013 21:53, schrieb Mr Goldcove:
 Easy Cap DC-60++
 Wrongly identified as card 19 EM2860/SAA711X Reference Design,
 resulting in no audio.
 Works perfectly when using card 64 Easy Cap Capture DC-60

Video inputs work fine, right ?
Does this device has any buttons / LEDs ?

The driver doesn't handle devices with generic IDs very well.
In this case we can conclude from the USB PID that the device has audio
support (which is actually the only difference to board
EM2860_BOARD_SAA711X_REFERENCE_DESIGN).
But I would like to think twice about it, because this kind of changes
has very a high potential to cause regressions for other boards...

Regards,
Frank


 **Interim solution**
 load module (before inserting the EasyCap. I'm having trouble if the
 module is loaded/unloaded with different cards...)
 modprobe em28xx card=64
   or
 add options em28xx card=64 to /etc/modprobe.d/local.conf

 **hw info**
 Bus 002 Device 005: ID eb1a:2861 eMPIA Technology, Inc.

 Chips:
 Empia EM2860 P7JY8-011 201023-01AG
 NXP SAA7113H
 RMC ALC653 89G06K1 G909A

 **logs**
 [ 5567.367883] em28xx: New device @ 480 Mbps (eb1a:2861, interface 0,
 class 0)
 [ 5567.367985] em28xx #0: chip ID is em2860
 [ 5567.380645] IR MCE Keyboard/mouse protocol handler initialized
 [ 5567.384202] lirc_dev: IR Remote Control driver registered, major 249
 [ 5567.385468] IR LIRC bridge handler initialized
 [ 5567.460386] em28xx #0: board has no eeprom
 [ 5567.534612] em28xx #0: found i2c device @ 0x4a [saa7113h]
 [ 5567.568303] em28xx #0: Your board has no unique USB ID.
 [ 5567.568308] em28xx #0: A hint were successfully done, based on i2c
 devicelist hash.
 [ 5567.568312] em28xx #0: This method is not 100% failproof.
 [ 5567.568314] em28xx #0: If the board were missdetected, please email
 this log to:
 [ 5567.568317] em28xx #0: V4L Mailing List 
 linux-media@vger.kernel.org
 [ 5567.568321] em28xx #0: Board detected as EM2860/SAA711X Reference Design
 [ 5567.647433] em28xx #0: Identified as EM2860/SAA711X Reference Design
 (card=19)
 [ 5567.647438] em28xx #0: Registering snapshot button...
 [ 5567.647531] input: em28xx snapshot button as
 /devices/pci:00/:00:1d.0/usb2/2-1/2-1.4/input/input11
 [ 5568.019310] saa7115 15-0025: saa7113 found (1f7113d0e10) @ 0x4a
 (em28xx #0)
 [ 5568.789385] em28xx #0: Config register raw data: 0x10
 [ 5568.813055] em28xx #0: AC97 vendor ID = 0x414c4761
 [ 5568.825074] em28xx #0: AC97 features = 0x
 [ 5568.825078] em28xx #0: Unknown AC97 audio processor detected!
 [ 5569.284137] em28xx #0: v4l2 driver version 0.1.3
 [ 5570.305831] em28xx #0: V4L2 video device registered as video1
 [ 5570.305835] em28xx #0: V4L2 VBI device registered as vbi0
 [ 5570.305862] em28xx audio device (eb1a:2861): interface 1, class 1
 [ 5570.305877] em28xx audio device (eb1a:2861): interface 2, class 1
 [ 5570.305906] usbcore: registered new interface driver em28xx
 [ 5570.305909] em28xx driver loaded
 [ 5570.392917] usbcore: registered new interface driver snd-usb-audio
 [ 7903.785365] em28xx #0: vidioc_s_fmt_vid_cap queue busy
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

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


Re: Wrongly identified easycap em28xx

2013-02-18 Thread Mr Goldcove
I've only tried composite video input.
The video/ audio output is good.
 
It has the following input:
RCA stereo sound
RCA video
S-video

It has no push button but has a green led which illuminates when the
device is in use.


On 18. feb. 2013 22:25, Frank Schäfer wrote:
 Am 18.02.2013 21:53, schrieb Mr Goldcove:
 Easy Cap DC-60++
 Wrongly identified as card 19 EM2860/SAA711X Reference Design,
 resulting in no audio.
 Works perfectly when using card 64 Easy Cap Capture DC-60
 Video inputs work fine, right ?
 Does this device has any buttons / LEDs ?

 The driver doesn't handle devices with generic IDs very well.
 In this case we can conclude from the USB PID that the device has audio
 support (which is actually the only difference to board
 EM2860_BOARD_SAA711X_REFERENCE_DESIGN).
 But I would like to think twice about it, because this kind of changes
 has very a high potential to cause regressions for other boards...

 Regards,
 Frank

 **Interim solution**
 load module (before inserting the EasyCap. I'm having trouble if the
 module is loaded/unloaded with different cards...)
 modprobe em28xx card=64
   or
 add options em28xx card=64 to /etc/modprobe.d/local.conf

 **hw info**
 Bus 002 Device 005: ID eb1a:2861 eMPIA Technology, Inc.

 Chips:
 Empia EM2860 P7JY8-011 201023-01AG
 NXP SAA7113H
 RMC ALC653 89G06K1 G909A

 **logs**
 [ 5567.367883] em28xx: New device @ 480 Mbps (eb1a:2861, interface 0,
 class 0)
 [ 5567.367985] em28xx #0: chip ID is em2860
 [ 5567.380645] IR MCE Keyboard/mouse protocol handler initialized
 [ 5567.384202] lirc_dev: IR Remote Control driver registered, major 249
 [ 5567.385468] IR LIRC bridge handler initialized
 [ 5567.460386] em28xx #0: board has no eeprom
 [ 5567.534612] em28xx #0: found i2c device @ 0x4a [saa7113h]
 [ 5567.568303] em28xx #0: Your board has no unique USB ID.
 [ 5567.568308] em28xx #0: A hint were successfully done, based on i2c
 devicelist hash.
 [ 5567.568312] em28xx #0: This method is not 100% failproof.
 [ 5567.568314] em28xx #0: If the board were missdetected, please email
 this log to:
 [ 5567.568317] em28xx #0: V4L Mailing List 
 linux-media@vger.kernel.org
 [ 5567.568321] em28xx #0: Board detected as EM2860/SAA711X Reference Design
 [ 5567.647433] em28xx #0: Identified as EM2860/SAA711X Reference Design
 (card=19)
 [ 5567.647438] em28xx #0: Registering snapshot button...
 [ 5567.647531] input: em28xx snapshot button as
 /devices/pci:00/:00:1d.0/usb2/2-1/2-1.4/input/input11
 [ 5568.019310] saa7115 15-0025: saa7113 found (1f7113d0e10) @ 0x4a
 (em28xx #0)
 [ 5568.789385] em28xx #0: Config register raw data: 0x10
 [ 5568.813055] em28xx #0: AC97 vendor ID = 0x414c4761
 [ 5568.825074] em28xx #0: AC97 features = 0x
 [ 5568.825078] em28xx #0: Unknown AC97 audio processor detected!
 [ 5569.284137] em28xx #0: v4l2 driver version 0.1.3
 [ 5570.305831] em28xx #0: V4L2 video device registered as video1
 [ 5570.305835] em28xx #0: V4L2 VBI device registered as vbi0
 [ 5570.305862] em28xx audio device (eb1a:2861): interface 1, class 1
 [ 5570.305877] em28xx audio device (eb1a:2861): interface 2, class 1
 [ 5570.305906] usbcore: registered new interface driver em28xx
 [ 5570.305909] em28xx driver loaded
 [ 5570.392917] usbcore: registered new interface driver snd-usb-audio
 [ 7903.785365] em28xx #0: vidioc_s_fmt_vid_cap queue busy
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

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


[PATCH v4 6/7] sound/soc/codecs: Convert SI476X codec to use regmap

2013-02-18 Thread Andrey Smirnov
From: Andrey Smirnov andreysm@charmander.(none)

The latest radio and MFD drivers for SI476X radio chips use regmap API
to provide access to the registers and allow for caching of their
values when the actual chip is powered off. Convert the codec driver
to do the same, so it would not loose the settings when the radio
driver powers the chip down.

Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com
---
 sound/soc/codecs/si476x.c |   22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index f2d61a1..30aebbe 100644
--- a/sound/soc/codecs/si476x.c
+++ b/sound/soc/codecs/si476x.c
@@ -45,13 +45,23 @@ static unsigned int si476x_codec_read(struct snd_soc_codec 
*codec,
  unsigned int reg)
 {
int err;
+   unsigned int val;
struct si476x_core *core = codec-control_data;
 
si476x_core_lock(core);
-   err = si476x_core_cmd_get_property(core, reg);
+   if (!si476x_core_is_powered_up(core))
+   regcache_cache_only(core-regmap, true);
+
+   err = regmap_read(core-regmap, reg, val);
+
+   if (!si476x_core_is_powered_up(core))
+   regcache_cache_only(core-regmap, false);
si476x_core_unlock(core);
 
-   return err;
+   if (err  0)
+   return err;
+
+   return val;
 }
 
 static int si476x_codec_write(struct snd_soc_codec *codec,
@@ -61,7 +71,13 @@ static int si476x_codec_write(struct snd_soc_codec *codec,
struct si476x_core *core = codec-control_data;
 
si476x_core_lock(core);
-   err = si476x_core_cmd_set_property(core, reg, val);
+   if (!si476x_core_is_powered_up(core))
+   regcache_cache_only(core-regmap, true);
+
+   err = regmap_write(core-regmap, reg, val);
+
+   if (!si476x_core_is_powered_up(core))
+   regcache_cache_only(core-regmap, false);
si476x_core_unlock(core);
 
return err;
-- 
1.7.10.4

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


[PATCH v4 1/7] mfd: Add header files and Kbuild plumbing for SI476x MFD core

2013-02-18 Thread Andrey Smirnov
From: Andrey Smirnov andreysm@charmander.(none)

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 andrew.smir...@gmail.com
---
 drivers/mfd/Kconfig |   13 +
 drivers/mfd/Makefile|4 +
 include/linux/mfd/si476x-core.h |  525 +++
 3 files changed, 542 insertions(+)
 create mode 100644 include/linux/mfd/si476x-core.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1c0abd4..3214927 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -970,6 +970,19 @@ 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 and TLL driver
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 8b977f8..bf7627b 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -131,6 +131,10 @@ obj-$(CONFIG_MFD_JZ4740_ADC)   += jz4740-adc.o
 obj-$(CONFIG_MFD_TPS6586X) += tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
+
+si476x-core-objs := si476x-cmd.o si476x-prop.o si476x-i2c.o
+obj-$(CONFIG_MFD_SI476X_CORE)  += si476x-core.o
+
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
 obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o omap-usb-tll.o
 obj-$(CONFIG_MFD_PM8921_CORE)  += pm8921-core.o
diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h
new file mode 100644
index 000..2136b26
--- /dev/null
+++ b/include/linux/mfd/si476x-core.h
@@ -0,0 +1,525 @@
+/*
+ * 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
+
+/* Command Timeouts */
+#define SI476X_DEFAULT_TIMEOUT 10
+#define SI476X_TIMEOUT_TUNE70
+#define SI476X_TIMEOUT_POWER_UP33
+#define SI476X_STATUS_POLL_US  0
+
+/*  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 representing the
+ * underlying core device which all the MFD cell-devices use.
+ *
+ * @client: Actual I2C client used to transfer 

[PATCH v4 7/7] sound/soc/codecs: Cosmetic changes to SI476X codec driver

2013-02-18 Thread Andrey Smirnov
- Add appropriate license header
- Change email address in MODULE_AUTHOR
- Remove trailing whitespaces

Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com
---
 sound/soc/codecs/si476x.c |   25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index 30aebbe..68b648a 100644
--- a/sound/soc/codecs/si476x.c
+++ b/sound/soc/codecs/si476x.c
@@ -1,3 +1,22 @@
+/*
+ * sound/soc/codecs/si476x.c -- Codec driver for SI476X chips
+ *
+ * Copyright (C) 2012 Innovative Converged Devices(ICD)
+ * Copyright (C) 2013 Andrey Smirnov
+ *
+ * Author: Andrey Smirnov andrew.smir...@gmail.com
+ *
+ * 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.
+ *
+ */
+
 #include linux/module.h
 #include linux/slab.h
 #include sound/pcm.h
@@ -156,7 +175,7 @@ static int si476x_codec_set_dai_fmt(struct snd_soc_dai 
*codec_dai,
dev_err(codec_dai-codec-dev, Failed to set output format\n);
return err;
}
-   
+
return 0;
 }
 
@@ -197,7 +216,7 @@ static int si476x_codec_hw_params(struct snd_pcm_substream 
*substream,
 
err = snd_soc_update_bits(dai-codec, SI476X_DIGITAL_IO_OUTPUT_FORMAT,
  SI476X_DIGITAL_IO_OUTPUT_WIDTH_MASK,
- (width  SI476X_DIGITAL_IO_SLOT_SIZE_SHIFT) 
| 
+ (width  SI476X_DIGITAL_IO_SLOT_SIZE_SHIFT) |
  (width  
SI476X_DIGITAL_IO_SAMPLE_SIZE_SHIFT));
if (err  0) {
dev_err(dai-codec-dev, Failed to set output width\n);
@@ -266,6 +285,6 @@ static struct platform_driver si476x_platform_driver = {
 };
 module_platform_driver(si476x_platform_driver);
 
-MODULE_AUTHOR(Andrey Smirnov andrey.smir...@convergeddevices.net);
+MODULE_AUTHOR(Andrey Smirnov andrew.smir...@gmail.com);
 MODULE_DESCRIPTION(ASoC Si4761/64 codec driver);
 MODULE_LICENSE(GPL);
-- 
1.7.10.4

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


[PATCH v4 0/7] Driver for Si476x series of chips

2013-02-18 Thread Andrey Smirnov
This is a fourth version of the patchset originaly posted here:
https://lkml.org/lkml/2012/9/13/590

Second version of the patch was posted here:
https://lkml.org/lkml/2012/10/5/598

Third version of the patch was posted here:
https://lkml.org/lkml/2012/10/23/510

To save everyone's time I'll repost the original description of it:

This patchset contains a driver for a Silicon Laboratories 476x series
of radio tuners. The driver itself is implemented as an MFD devices
comprised of three parts: 
 1. Core device that provides all the other devices with basic
functionality and locking scheme.
 2. Radio device that translates between V4L2 subsystem requests into
Core device commands.
 3. Codec device that does similar to the earlier described task, but
for ALSA SoC subsystem.

v4 of this driver has following changes:
 - All of the adjustable timeouts(expose via sysfs) are gone
 - Names of the controls are changes as was requested
 - Added documentation for exposed debugfs files 
 - Minor fix in si476x_radio_fops_poll
 - DBG_BUFFER is removed
 - Tested for compilation w/o debugfs enabled

This version still has all the radio controls being private. The
reason for that is because I am not sure how that should be handled.

Hans, do you want me to move all the controls to be standard, that is
exted V4L's with the needed controls? Should I pick up the parts of
http://lists-archives.com/linux-kernel/27641304-radio-fixes-and-new-features-for-fm.html
 and take relevants bits and pieces of it?

How do you want that to be handled?



Here is v4l2-compliance output for one of the tuners:
sudo v4l2-compliance -r /dev/radio0
is radio
Driver Info:
Driver name   : si476x-radio0
Card type : SI476x AM/FM Receiver
Bus info  : platform:si476x-radio0
Driver version: 3.1.0
Capabilities  : 0x81050500
RDS Capture
Tuner
Radio
Read/Write
Device Capabilities
Device Caps   : 0x01050500
RDS Capture
Tuner
Radio
Read/Write

Compliance test for device /dev/radio0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second radio open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G_CHIP_IDENT: OK
test VIDIOC_DBG_G/S_REGISTER: OK
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER: OK
test VIDIOC_G/S_FREQUENCY: OK
test VIDIOC_S_HW_FREQ_SEEK: OK
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 1

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Control ioctls:
test VIDIOC_QUERYCTRL/MENU: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 2 Private Controls: 8

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_PRESETS: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported)
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK (Not Supported)
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported)

Total: 38, Succeeded: 38, Failed: 0, Warnings: 0

Andrey Smirnov (7):
  mfd: Add header files and Kbuild plumbing for SI476x MFD core
  mfd: Add commands abstraction layer for SI476X MFD
  mfd: Add the main bulk of core driver for SI476x code
  mfd: Add chip properties handling code for SI476X MFD
  v4l2: Add a V4L2 driver for SI476X MFD
  sound/soc/codecs: Convert SI476X codec to use regmap
  sound/soc/codecs: Cosmetic changes to SI476X codec driver

 Documentation/video4linux/si476x.txt |  187 
 drivers/media/radio/Kconfig  |   17 +
 drivers/media/radio/Makefile |1 +
 

[PATCH v4 4/7] mfd: Add chip properties handling code for SI476X MFD

2013-02-18 Thread Andrey Smirnov
From: Andrey Smirnov andreysm@charmander.(none)

This patch adds code related to manipulation of the properties of
SI476X chips.

Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com
---
 drivers/mfd/si476x-prop.c |  234 +
 1 file changed, 234 insertions(+)
 create mode 100644 drivers/mfd/si476x-prop.c

diff --git a/drivers/mfd/si476x-prop.c b/drivers/mfd/si476x-prop.c
new file mode 100644
index 000..d2b5cc0
--- /dev/null
+++ b/drivers/mfd/si476x-prop.c
@@ -0,0 +1,234 @@
+/*
+ * drivers/mfd/si476x-prop.c -- Subroutines to manipulate with
+ * properties of si476x chips
+ *
+ * Copyright (C) 2012 Innovative Converged Devices(ICD)
+ * Copyright (C) 2013 Andrey Smirnov
+ *
+ * Author: Andrey Smirnov andrew.smir...@gmail.com
+ *
+ * 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.
+ */
+#include linux/module.h
+
+#include media/si476x.h
+#include linux/mfd/si476x-core.h
+
+struct si476x_property_range {
+   u16 low, high;
+};
+
+static bool si476x_core_element_is_in_array(u16 element, const u16 array[], 
size_t size)
+{
+   int i;
+
+   for (i = 0; i  size; i++)
+   if (element == array[i])
+   return true;
+
+   return false;
+}
+
+static bool si476x_core_element_is_in_range(u16 element,
+   const struct si476x_property_range 
range[],
+   size_t size)
+{
+   int i;
+
+   for (i = 0; i  size; i++)
+   if (element = range[i].high  element = range[i].low)
+   return true;
+
+   return false;
+}
+
+static bool si476x_core_is_valid_property_a10(struct si476x_core *core,
+ u16 property)
+{
+   static const u16 valid_properties[] = {
+   0x,
+   0x0500, 0x0501,
+   0x0600,
+   0x0709, 0x070C, 0x070D, 0x70E, 0x710,
+   0x0718,
+   0x1207, 0x1208,
+   0x2007,
+   0x2300,
+   };
+
+   static const struct si476x_property_range valid_ranges[] = {
+   { 0x0200, 0x0203 },
+   { 0x0300, 0x0303 },
+   { 0x0400, 0x0404 },
+   { 0x0700, 0x0707 },
+   { 0x1100, 0x1102 },
+   { 0x1200, 0x1204 },
+   { 0x1300, 0x1306 },
+   { 0x2000, 0x2005 },
+   { 0x2100, 0x2104 },
+   { 0x2106, 0x2106 },
+   { 0x2200, 0x220E },
+   { 0x3100, 0x3104 },
+   { 0x3207, 0x320F },
+   { 0x3300, 0x3304 },
+   { 0x3500, 0x3517 },
+   { 0x3600, 0x3617 },
+   { 0x3700, 0x3717 },
+   { 0x4000, 0x4003 },
+   };
+
+   return  si476x_core_element_is_in_range(property, valid_ranges,
+   ARRAY_SIZE(valid_ranges)) ||
+   si476x_core_element_is_in_array(property, valid_properties,
+   ARRAY_SIZE(valid_properties));
+}
+
+static bool si476x_core_is_valid_property_a20(struct si476x_core *core,
+ u16 property)
+{
+   static const u16 valid_properties[] = {
+   0x071B,
+   0x1006,
+   0x2210,
+   0x3401,
+   };
+
+   static const struct si476x_property_range valid_ranges[] = {
+   { 0x2215, 0x2219 },
+   };
+
+   return  si476x_core_is_valid_property_a10(core, property) ||
+   si476x_core_element_is_in_range(property, valid_ranges,
+   ARRAY_SIZE(valid_ranges))  ||
+   si476x_core_element_is_in_array(property, valid_properties,
+   ARRAY_SIZE(valid_properties));
+}
+
+static bool si476x_core_is_valid_property_a30(struct si476x_core *core,
+ u16 property)
+{
+   static const u16 valid_properties[] = {
+   0x071C, 0x071D,
+   0x1007, 0x1008,
+   0x220F, 0x2214,
+   0x2301,
+   0x3105, 0x3106,
+   0x3402,
+   };
+
+   static const struct si476x_property_range valid_ranges[] = {
+   { 0x0405, 0x0411 },
+   { 0x2008, 0x200B },
+   { 0x2220, 0x2223 },
+   { 0x3100, 0x3106 },
+   };
+
+   return  si476x_core_is_valid_property_a20(core, property) ||
+   

[PATCH v4 3/7] mfd: Add the main bulk of core driver for SI476x code

2013-02-18 Thread Andrey Smirnov
From: Andrey Smirnov andreysm@charmander.(none)

This patch adds main part(out of three) of the I2C driver for the
core of MFD device.

Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com
---
 drivers/mfd/si476x-i2c.c |  878 ++
 1 file changed, 878 insertions(+)
 create mode 100644 drivers/mfd/si476x-i2c.c

diff --git a/drivers/mfd/si476x-i2c.c b/drivers/mfd/si476x-i2c.c
new file mode 100644
index 000..053a6a3
--- /dev/null
+++ b/drivers/mfd/si476x-i2c.c
@@ -0,0 +1,878 @@
+/*
+ * drivers/mfd/si476x-i2c.c -- Core device driver for si476x MFD
+ * device
+ *
+ * Copyright (C) 2012 Innovative Converged Devices(ICD)
+ * Copyright (C) 2013 Andrey Smirnov
+ *
+ * Author: Andrey Smirnov andrew.smir...@gmail.com
+ *
+ * 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.
+ *
+ */
+#include linux/module.h
+
+#include linux/slab.h
+#include linux/interrupt.h
+#include linux/delay.h
+#include linux/gpio.h
+#include linux/regulator/consumer.h
+#include linux/i2c.h
+#include linux/err.h
+
+#include linux/mfd/si476x-core.h
+
+#define SI476X_MAX_IO_ERRORS   10
+#define SI476X_DRIVER_RDS_FIFO_DEPTH   128
+
+/**
+ * si476x_core_config_pinmux() - pin function configuration function
+ *
+ * @core: Core device structure
+ *
+ * Configure the functions of the pins of the radio chip.
+ *
+ * The function returns zero in case of succes or negative error code
+ * otherwise.
+ */
+static int si476x_core_config_pinmux(struct si476x_core *core)
+{
+   int err;
+   dev_dbg(core-client-dev, Configuring pinmux\n);
+   err = si476x_core_cmd_dig_audio_pin_cfg(core,
+   core-pinmux.dclk,
+   core-pinmux.dfs,
+   core-pinmux.dout,
+   core-pinmux.xout);
+   if (err  0) {
+   dev_err(core-client-dev,
+   Failed to configure digital audio pins(err = %d)\n,
+   err);
+   return err;
+   }
+
+   err = si476x_core_cmd_zif_pin_cfg(core,
+ core-pinmux.iqclk,
+ core-pinmux.iqfs,
+ core-pinmux.iout,
+ core-pinmux.qout);
+   if (err  0) {
+   dev_err(core-client-dev,
+   Failed to configure ZIF pins(err = %d)\n,
+   err);
+   return err;
+   }
+
+   err = si476x_core_cmd_ic_link_gpo_ctl_pin_cfg(core,
+ core-pinmux.icin,
+ core-pinmux.icip,
+ core-pinmux.icon,
+ core-pinmux.icop);
+   if (err  0) {
+   dev_err(core-client-dev,
+   Failed to configure IC-Link/GPO pins(err = %d)\n,
+   err);
+   return err;
+   }
+
+   err = si476x_core_cmd_ana_audio_pin_cfg(core,
+   core-pinmux.lrout);
+   if (err  0) {
+   dev_err(core-client-dev,
+   Failed to configure analog audio pins(err = %d)\n,
+   err);
+   return err;
+   }
+
+   err = si476x_core_cmd_intb_pin_cfg(core,
+  core-pinmux.intb,
+  core-pinmux.a1);
+   if (err  0) {
+   dev_err(core-client-dev,
+   Failed to configure interrupt pins(err = %d)\n,
+   err);
+   return err;
+   }
+
+   return 0;
+}
+
+static inline void si476x_core_schedule_polling_work(struct si476x_core *core)
+{
+   schedule_delayed_work(core-status_monitor,
+ usecs_to_jiffies(SI476X_STATUS_POLL_US));
+}
+
+/**
+ * si476x_core_start() - early chip startup function
+ * @core: Core device structure
+ * @soft: When set, this flag forces soft startup, where soft
+ * power down is the one done by sending appropriate command instead
+ * of using reset pin of the tuner
+ *
+ * Perform required startup sequence to correctly power
+ * up the chip and perform initial configuration. It does the
+ * following sequence of actions:
+ *   1. Claims and enables the power supplies VD and VIO1 required
+ *  

[PATCH v4 2/7] mfd: Add commands abstraction layer for SI476X MFD

2013-02-18 Thread Andrey Smirnov
From: Andrey Smirnov andreysm@charmander.(none)

This patch adds all the functions used for exchanging commands with
the chip.

Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com
---
 drivers/mfd/si476x-cmd.c | 1553 ++
 1 file changed, 1553 insertions(+)
 create mode 100644 drivers/mfd/si476x-cmd.c

diff --git a/drivers/mfd/si476x-cmd.c b/drivers/mfd/si476x-cmd.c
new file mode 100644
index 000..0ae1b63
--- /dev/null
+++ b/drivers/mfd/si476x-cmd.c
@@ -0,0 +1,1553 @@
+/*
+ * drivers/mfd/si476x-cmd.c -- Subroutines implementing command
+ * protocol of si476x series of chips
+ *
+ * Copyright (C) 2012 Innovative Converged Devices(ICD)
+ * Copyright (C) 2013 Andrey Smirnov
+ *
+ * Author: Andrey Smirnov andrew.smir...@gmail.com
+ *
+ * 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.
+ *
+ */
+
+#include linux/module.h
+#include linux/completion.h
+#include linux/delay.h
+#include linux/atomic.h
+#include linux/i2c.h
+#include linux/device.h
+#include linux/gpio.h
+#include linux/videodev2.h
+
+#include media/si476x.h
+#include linux/mfd/si476x-core.h
+
+#define msb(x)  ((u8)((u16) x  8))
+#define lsb(x)  ((u8)((u16) x   0x00FF))
+
+
+
+#define CMD_POWER_UP   0x01
+#define CMD_POWER_UP_A10_NRESP 1
+#define CMD_POWER_UP_A10_NARGS 5
+
+#define CMD_POWER_UP_A20_NRESP 1
+#define CMD_POWER_UP_A20_NARGS 5
+
+#define POWER_UP_DELAY_MS  110
+
+#define CMD_POWER_DOWN 0x11
+#define CMD_POWER_DOWN_A10_NRESP   1
+
+#define CMD_POWER_DOWN_A20_NRESP   1
+#define CMD_POWER_DOWN_A20_NARGS   1
+
+#define CMD_FUNC_INFO  0x12
+#define CMD_FUNC_INFO_NRESP7
+
+#define CMD_SET_PROPERTY   0x13
+#define CMD_SET_PROPERTY_NARGS 5
+#define CMD_SET_PROPERTY_NRESP 1
+
+#define CMD_GET_PROPERTY   0x14
+#define CMD_GET_PROPERTY_NARGS 3
+#define CMD_GET_PROPERTY_NRESP 4
+
+#define CMD_AGC_STATUS 0x17
+#define CMD_AGC_STATUS_NRESP_A10   2
+#define CMD_AGC_STATUS_NRESP_A206
+
+#define PIN_CFG_BYTE(x) (0x7F  (x))
+#define CMD_DIG_AUDIO_PIN_CFG  0x18
+#define CMD_DIG_AUDIO_PIN_CFG_NARGS4
+#define CMD_DIG_AUDIO_PIN_CFG_NRESP5
+
+#define CMD_ZIF_PIN_CFG0x19
+#define CMD_ZIF_PIN_CFG_NARGS  4
+#define CMD_ZIF_PIN_CFG_NRESP  5
+
+#define CMD_IC_LINK_GPO_CTL_PIN_CFG0x1A
+#define CMD_IC_LINK_GPO_CTL_PIN_CFG_NARGS  4
+#define CMD_IC_LINK_GPO_CTL_PIN_CFG_NRESP  5
+
+#define CMD_ANA_AUDIO_PIN_CFG  0x1B
+#define CMD_ANA_AUDIO_PIN_CFG_NARGS1
+#define CMD_ANA_AUDIO_PIN_CFG_NRESP2
+
+#define CMD_INTB_PIN_CFG   0x1C
+#define CMD_INTB_PIN_CFG_NARGS 2
+#define CMD_INTB_PIN_CFG_A10_NRESP 6
+#define CMD_INTB_PIN_CFG_A20_NRESP 3
+
+#define CMD_FM_TUNE_FREQ   0x30
+#define CMD_FM_TUNE_FREQ_A10_NARGS 5
+#define CMD_FM_TUNE_FREQ_A20_NARGS 3
+#define CMD_FM_TUNE_FREQ_NRESP 1
+
+#define CMD_FM_RSQ_STATUS  0x32
+
+#define CMD_FM_RSQ_STATUS_A10_NARGS1
+#define CMD_FM_RSQ_STATUS_A10_NRESP17
+#define CMD_FM_RSQ_STATUS_A30_NARGS1
+#define CMD_FM_RSQ_STATUS_A30_NRESP23
+
+
+#define CMD_FM_SEEK_START  0x31
+#define CMD_FM_SEEK_START_NARGS1
+#define CMD_FM_SEEK_START_NRESP1
+
+#define CMD_FM_RDS_STATUS  0x36
+#define CMD_FM_RDS_STATUS_NARGS1
+#define CMD_FM_RDS_STATUS_NRESP16
+
+#define CMD_FM_RDS_BLOCKCOUNT  0x37
+#define CMD_FM_RDS_BLOCKCOUNT_NARGS1
+#define CMD_FM_RDS_BLOCKCOUNT_NRESP8
+
+#define CMD_FM_PHASE_DIVERSITY 0x38
+#define CMD_FM_PHASE_DIVERSITY_NARGS   1
+#define CMD_FM_PHASE_DIVERSITY_NRESP   1
+
+#define CMD_FM_PHASE_DIV_STATUS0x39
+#define CMD_FM_PHASE_DIV_STATUS_NRESP  2
+
+#define CMD_AM_TUNE_FREQ   0x40
+#define CMD_AM_TUNE_FREQ_NARGS 3
+#define CMD_AM_TUNE_FREQ_NRESP 1
+
+#define 

Re: [PATCH v4 0/7] Driver for Si476x series of chips

2013-02-18 Thread Hans Verkuil
On Monday, February 18, 2013 19:59:28 Andrey Smirnov wrote:
 This is a fourth version of the patchset originaly posted here:
 https://lkml.org/lkml/2012/9/13/590
 
 Second version of the patch was posted here:
 https://lkml.org/lkml/2012/10/5/598
 
 Third version of the patch was posted here:
 https://lkml.org/lkml/2012/10/23/510
 
 To save everyone's time I'll repost the original description of it:
 
 This patchset contains a driver for a Silicon Laboratories 476x series
 of radio tuners. The driver itself is implemented as an MFD devices
 comprised of three parts: 
  1. Core device that provides all the other devices with basic
 functionality and locking scheme.
  2. Radio device that translates between V4L2 subsystem requests into
 Core device commands.
  3. Codec device that does similar to the earlier described task, but
 for ALSA SoC subsystem.
 
 v4 of this driver has following changes:
  - All of the adjustable timeouts(expose via sysfs) are gone
  - Names of the controls are changes as was requested
  - Added documentation for exposed debugfs files 
  - Minor fix in si476x_radio_fops_poll
  - DBG_BUFFER is removed
  - Tested for compilation w/o debugfs enabled
 
 This version still has all the radio controls being private. The
 reason for that is because I am not sure how that should be handled.
 
 Hans, do you want me to move all the controls to be standard, that is
 exted V4L's with the needed controls? Should I pick up the parts of
 http://lists-archives.com/linux-kernel/27641304-radio-fixes-and-new-features-for-fm.html
  and take relevants bits and pieces of it?

Yes, please do that. It's too bad that never made it into the kernel, so let's
do it now.

So take the controls that you can use from that patch and leave out those that
do not apply to your driver. From the remaining controls not covered by that
patch you will have to decide which are truly chip-specific and which are
valid for any advanced radio receiver.

The really chip(set) specific controls should be put in their own header,
but add the base control ID to v4l2-controls.h (see for example the way that
is done for the MEYE controls).

If you can do that quickly and post a v5, then I will do my best to review
it this week or Monday at the latest. Let's finish this driver asap.

Regards,

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