[PATCH] [0906_03] Siano: Update KConfig File to enable SDIO and USB interfaces

2009-06-28 Thread Udi Atar
# HG changeset patch
# User Udi Atar 
# Date 1246193615 -10800
# Node ID 32672e1ce386bc0da3f581576c312c447aabab01
# Parent  732b628672570537eb78109314fb60fa8f0efaf6
Update KConfig File to enable SDIO and USB interfaces

From: Udi Atar 

Update KConfig file to enbale selection of SDIO and USB
interfaces, and add dependancy on relevant modules.

Priority: normal

Signed-off-by: Udi Atar 

diff -r 732b62867257 -r 32672e1ce386 linux/drivers/media/dvb/siano/Kconfig
--- a/linux/drivers/media/dvb/siano/Kconfig Sun Jun 28 09:58:01 2009 +0300
+++ b/linux/drivers/media/dvb/siano/Kconfig Sun Jun 28 15:53:35 2009 +0300
@@ -2,25 +2,37 @@
 # Siano Mobile Silicon Digital TV device configuration
 #

-config DVB_SIANO_SMS1XXX
-   tristate "Siano SMS1XXX USB dongle support"
+config SMS_SIANO_MDTV
+   tristate "Siano SMS1xxx based MDTV receiver"
+   depends on DVB_CORE
+   default m
+   ---help---
+   Choose Y or M here if you have MDTV receiver with a Siano chipset.
+
+   To compile this driver as a module, choose M here
+   (The module will be called smsmdtv).
+
+   Further documentation on this driver can be found on the WWW
+   at http://www.siano-ms.com/
+
+if SMS_SIANO_MDTV
+menu "Siano module components"
+
+# Hardware interfaces support
+
+config SMS_USB_DRV
+   tristate "USB interface support"
depends on DVB_CORE && USB
+   default m
---help---
- Choose Y here if you have a USB dongle with a SMS1XXX chipset.
+   Choose if you would like to have Siano's support for USB interface

- To compile this driver as a module, choose M here: the
- module will be called sms1xxx.
+config SMS_SDIO_DRV
+   tristate "SDIO interface support"
+   depends on DVB_CORE && MMC
+   default m
+   ---help---
+   Choose if you would like to have Siano's support for SDIO interface

-config DVB_SIANO_SMS1XXX_SMS_IDS
-   bool "Enable support for Siano Mobile Silicon default USB IDs"
-   depends on DVB_SIANO_SMS1XXX
-   default y
-   ---help---
- Choose Y here if you have a USB dongle with a SMS1XXX chipset
- that uses Siano Mobile Silicon's default usb vid:pid.
-
- Choose N here if you would prefer to use Siano's external driver.
-
- Further documentation on this driver can be found on the WWW at
- <http://www.siano-ms.com/>.
-
+endmenu
+endif # SMS_SIANO_MDTV
diff -r 732b62867257 -r 32672e1ce386 linux/drivers/media/dvb/siano/Makefile
--- a/linux/drivers/media/dvb/siano/MakefileSun Jun 28 09:58:01 2009 +0300
+++ b/linux/drivers/media/dvb/siano/MakefileSun Jun 28 15:53:35 2009 +0300
@@ -1,8 +1,9 @@
-sms1xxx-objs := smscoreapi.o sms-cards.o smsendian.o smsir.o

-obj-$(CONFIG_DVB_SIANO_SMS1XXX) += sms1xxx.o
-obj-$(CONFIG_DVB_SIANO_SMS1XXX) += smsusb.o
-obj-$(CONFIG_DVB_SIANO_SMS1XXX) += smsdvb.o
+smsmdtv-objs := smscoreapi.o sms-cards.o smsendian.o smsir.o
+
+obj-$(CONFIG_SMS_SIANO_MDTV) += smsmdtv.o smsdvb.o
+obj-$(CONFIG_SMS_USB_DRV) += smsusb.o
+obj-$(CONFIG_SMS_SDIO_DRV) += smssdio.o

 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
--
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] [0906_02] Siano: Fixed SDIO compilation bugs

2009-06-28 Thread Udi Atar
# HG changeset patch
# User Udi Atar 
# Date 1246172281 -10800
# Node ID 732b628672570537eb78109314fb60fa8f0efaf6
# Parent  05e6c5c9bcb401055acc74d4781bbd3ab345a1f4
Fix SDIO compilation bugs

From: Udi Atar 

Fixed SDIO compilation bugs (for latest kernel).
Also fixed a memory overrun issue in buffer management.

Priority: normal

Signed-off-by: Udi Atar 

diff -r 05e6c5c9bcb4 -r 732b62867257 linux/drivers/media/dvb/siano/smssdio.c
--- a/linux/drivers/media/dvb/siano/smssdio.c   Tue Jun 23 21:11:47 2009 -0300
+++ b/linux/drivers/media/dvb/siano/smssdio.c   Sun Jun 28 09:58:01 2009 +0300
@@ -46,6 +46,7 @@

 #define SMSSDIO_DATA   0x00
 #define SMSSDIO_INT0x04
+#define SMSSDIO_BLOCK_SIZE 128

 static const struct sdio_device_id smssdio_ids[] = {
{SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_STELLAR),
@@ -85,7 +86,8 @@
sdio_claim_host(smsdev->func);

while (size >= smsdev->func->cur_blksize) {
-   ret = sdio_write_blocks(smsdev->func, SMSSDIO_DATA, buffer, 1);
+   ret = sdio_memcpy_toio(smsdev->func, SMSSDIO_DATA,
+   buffer, smsdev->func->cur_blksize);
if (ret)
goto out;

@@ -94,8 +96,8 @@
}

if (size) {
-   ret = sdio_write_bytes(smsdev->func, SMSSDIO_DATA,
-  buffer, size);
+   ret = sdio_memcpy_toio(smsdev->func, SMSSDIO_DATA,
+   buffer, size);
}

 out:
@@ -125,23 +127,23 @@
 */
isr = sdio_readb(func, SMSSDIO_INT, &ret);
if (ret) {
-   dev_err(&smsdev->func->dev,
-   "Unable to read interrupt register!\n");
+   sms_err("Unable to read interrupt register!\n");
return;
}

if (smsdev->split_cb == NULL) {
cb = smscore_getbuffer(smsdev->coredev);
if (!cb) {
-   dev_err(&smsdev->func->dev,
-   "Unable to allocate data buffer!\n");
+   sms_err("Unable to allocate data buffer!\n");
return;
}

-   ret = sdio_read_blocks(smsdev->func, cb->p, SMSSDIO_DATA, 1);
+   ret = sdio_memcpy_fromio(smsdev->func,
+cb->p,
+SMSSDIO_DATA,
+SMSSDIO_BLOCK_SIZE);
if (ret) {
-   dev_err(&smsdev->func->dev,
-   "Error %d reading initial block!\n", ret);
+   sms_err("Error %d reading initial block!\n", ret);
return;
}

@@ -152,7 +154,10 @@
return;
}

-   size = hdr->msgLength - smsdev->func->cur_blksize;
+   if (hdr->msgLength > smsdev->func->cur_blksize)
+   size = hdr->msgLength - smsdev->func->cur_blksize;
+   else
+   size = 0;
} else {
cb = smsdev->split_cb;
hdr = cb->p;
@@ -162,23 +167,24 @@
smsdev->split_cb = NULL;
}

-   if (hdr->msgLength > smsdev->func->cur_blksize) {
+   if (size) {
void *buffer;

-   size = ALIGN(size, 128);
-   buffer = cb->p + hdr->msgLength;
+   buffer = cb->p + (hdr->msgLength - size);
+   size = ALIGN(size, SMSSDIO_BLOCK_SIZE);

-   BUG_ON(smsdev->func->cur_blksize != 128);
+   BUG_ON(smsdev->func->cur_blksize != SMSSDIO_BLOCK_SIZE);

/*
 * First attempt to transfer all of it in one go...
 */
-   ret = sdio_read_blocks(smsdev->func, buffer,
-  SMSSDIO_DATA, size / 128);
+   ret = sdio_memcpy_fromio(smsdev->func,
+buffer,
+SMSSDIO_DATA,
+size);
if (ret && ret != -EINVAL) {
smscore_putbuffer(smsdev->coredev, cb);
-   dev_err(&smsdev->func->dev,
-   "Error %d reading data from card!\n", ret);
+   sms_err("Error %d reading data from card!\n", ret);
return;
}

@@ -191,12 +197,12 @@
 */
if (ret == -EINVAL) {
while (size) {
-  

[PATCH] [09061_01] Siano: Update KConfig and Makefile

2009-06-17 Thread Udi Atar
# HG changeset patch
# User Udi Atar 
# Date 1245248482 -10800
# Node ID 46081b3e60046b900c9c8110513224911df8e106
# Parent  b385a43af222b6c8d2d93937644eb936f63d81e3
Update Siano KConfig file

From: Udi Atar 

Priority: normal

Signed-off-by: Udi Atar 

diff -r b385a43af222 -r 46081b3e6004 linux/drivers/media/dvb/siano/Kconfig
--- a/linux/drivers/media/dvb/siano/Kconfig Tue Jun 16 23:55:44 2009 -0300
+++ b/linux/drivers/media/dvb/siano/Kconfig Wed Jun 17 17:21:22 2009 +0300
@@ -2,25 +2,32 @@
 # Siano Mobile Silicon Digital TV device configuration
 #

-config DVB_SIANO_SMS1XXX
-   tristate "Siano SMS1XXX USB dongle support"
-   depends on DVB_CORE && USB
+config SMS_SIANO_MDTV
+   tristate "Siano SMS1xxx based MDTV receiver"
+   default m
---help---
- Choose Y here if you have a USB dongle with a SMS1XXX chipset.
+   Choose Y or M here if you have MDTV receiver with a Siano chipset.

- To compile this driver as a module, choose M here: the
- module will be called sms1xxx.
+   To compile this driver as a module, choose M here
+   (The modules will be called smsmdtv).

-config DVB_SIANO_SMS1XXX_SMS_IDS
-   bool "Enable support for Siano Mobile Silicon default USB IDs"
-   depends on DVB_SIANO_SMS1XXX
-   default y
+   Note: All dependents, if selected, will be part of this module.
+
+   Further documentation on this driver can be found on the WWW
+   at http://www.siano-ms.com/
+
+if SMS_SIANO_MDTV
+menu "Siano module components"
+
+# Hardware interfaces support
+
+config SMS_USB_DRV
+   tristate "USB interface support"
+   depends on USB
+   default m if USB
---help---
- Choose Y here if you have a USB dongle with a SMS1XXX chipset
- that uses Siano Mobile Silicon's default usb vid:pid.
+   Choose if you would like to have Siano's support for USB interface

- Choose N here if you would prefer to use Siano's external driver.

- Further documentation on this driver can be found on the WWW at
- <http://www.siano-ms.com/>.
-
+endmenu
+endif # SMS_SIANO_MDTV
diff -r b385a43af222 -r 46081b3e6004 linux/drivers/media/dvb/siano/Makefile
--- a/linux/drivers/media/dvb/siano/MakefileTue Jun 16 23:55:44 2009 -0300
+++ b/linux/drivers/media/dvb/siano/MakefileWed Jun 17 17:21:22 2009 +0300
@@ -1,8 +1,8 @@
-sms1xxx-objs := smscoreapi.o sms-cards.o smsendian.o smsir.o

-obj-$(CONFIG_DVB_SIANO_SMS1XXX) += sms1xxx.o
-obj-$(CONFIG_DVB_SIANO_SMS1XXX) += smsusb.o
-obj-$(CONFIG_DVB_SIANO_SMS1XXX) += smsdvb.o
+smsmdtv-objs := smscoreapi.o sms-cards.o smsendian.o smsir.o
+
+obj-$(CONFIG_SMS_SIANO_MDTV) += smsmdtv.o smsdvb.o
+obj-$(CONFIG_SMS_USB_DRV) += smsusb.o

 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
--
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: [PATCH] [09051_49] Siano: smscore - upgrade firmware loading engine

2009-06-17 Thread Udi Atar
On Tue, Jun 16, 2009 at 7:44 PM, Mauro Carvalho
Chehab wrote:
> Em Tue, 16 Jun 2009 15:39:01 +0300
> "Udi Atar"  escreveu:
>
>> The README.patches file in v4l-dvb clearly states that it is OK to use 
>> version checking to allow backporting.
>>
>> 
>> k) Sometimes it is necessary to introduce some testing code inside a
>>    module or remove parts that are not yet finished. Also, compatibility
>>    tests may be required to provide backporting.
>>
>>    To allow compatibility tests, linux/version.h is automatically
>>    included by the building system. This allows adding tests like:
>>
>>       #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
>>       #include 
>>       #else
>>       #include 
>>       #endif
>> 
>>
>> The patch allows older version of the kernel, and embedded platforms, that 
>> choose not to include the "request firmware" mechanism to continue working 
>> with the Siano driver.
>
> I don't see a big issue with this, provided that this won't affect the 
> upstream driver.
>
>> As for the SMS_HOSTLIB_SUBSYS, the Siano driver supports standards which are 
>> not currently implemented in V4L (i.e. CMMB). I see no reason why we should 
>> create a duplicate driver for DVB-T and CMMB, if the codebase is exactly the 
>> same.
>
> The proper way is to add support for those standards at DVB API, instead of
> using a proprietary API.
>
> In order to keep the merging process of the pending patches, I suggest you to
> remove the the SMS_HOSTLIB_SUBSYS part from this patch and re-submit the
> pending ones up to the point where the only pending issue to sync your 
> codebase
> with kernel being the API for those non-supported standards. After that, we 
> can
> discuss the API improvement needs to support the missing standards.
>>
>> Best regards,
>> Udi Atar
>>
>>
>> -Original Message-
>> From: linux-media-ow...@vger.kernel.org 
>> [mailto:linux-media-ow...@vger.kernel.org] On Behalf Of Michael Krufky
>> Sent: Tuesday, May 19, 2009 7:24 PM
>> To: Uri Shkolnik
>> Cc: LinuxML; Mauro Carvalho Chehab
>> Subject: Re: [PATCH] [09051_49] Siano: smscore - upgrade firmware loading 
>> engine
>>
>> On Tue, May 19, 2009 at 11:43 AM, Uri Shkolnik  wrote:
>> >
>> > # HG changeset patch
>> > # User Uri Shkolnik 
>> > # Date 1242748115 -10800
>> > # Node ID 4d75f9d1c4f96d65a8ad312c21e488a212ee58a3
>> > # Parent  cfb4106f3ceaee9fe8f7e3acc9d4adec1baffe5e
>> > [09051_49] Siano: smscore - upgrade firmware loading engine
>> >
>> > From: Uri Shkolnik 
>> >
>> > Upgrade the firmware loading (download and switching) engine.
>> >
>> > Priority: normal
>> >
>> > Signed-off-by: Uri Shkolnik 
>> >
>> > diff -r cfb4106f3cea -r 4d75f9d1c4f9 
>> > linux/drivers/media/dvb/siano/smscoreapi.c
>> > --- a/linux/drivers/media/dvb/siano/smscoreapi.c        Tue May 19 
>> > 18:38:07 2009 +0300
>> > +++ b/linux/drivers/media/dvb/siano/smscoreapi.c        Tue May 19 
>> > 18:48:35 2009 +0300
>> > @@ -28,7 +28,7 @@
>> >  #include 
>> >  #include 
>> >  #include 
>> > -
>> > +#include 
>> >  #include 
>> >  #include 
>> >  #include 
>> > @@ -36,7 +36,13 @@
>> >  #include "smscoreapi.h"
>> >  #include "sms-cards.h"
>> >  #include "smsir.h"
>> > -#include "smsendian.h"
>> > +#define MAX_GPIO_PIN_NUMBER    31
>> > +
>> > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10)
>> > +#define REQUEST_FIRMWARE_SUPPORTED
>> > +#else
>> > +#define DEFAULT_FW_FILE_PATH "/lib/firmware"
>> > +#endif
>> >
>> >  static int sms_dbg;
>> >  module_param_named(debug, sms_dbg, int, 0644);
>> > @@ -459,8 +465,6 @@ static int smscore_init_ir(struct smscor
>> >                                msg->msgData[0] = coredev->ir.controller;
>> >                                msg->msgData[1] = coredev->ir.timeout;
>> >
>> > -                               smsendian_handle_tx_message(
>> > -                                       (struct SmsMsgHdr_ST2 *)msg);
>> >                                rc = smscore_sendrequest_and_wait(coredev, 
>> > msg,
>>

RE: [PATCH] [09051_49] Siano: smscore - upgrade firmware loading engine

2009-06-16 Thread Udi Atar
The README.patches file in v4l-dvb clearly states that it is OK to use version 
checking to allow backporting.


k) Sometimes it is necessary to introduce some testing code inside a
   module or remove parts that are not yet finished. Also, compatibility
   tests may be required to provide backporting.

   To allow compatibility tests, linux/version.h is automatically
   included by the building system. This allows adding tests like:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)
#include 
#else
#include 
#endif


The patch allows older version of the kernel, and embedded platforms, that 
choose not to include the "request firmware" mechanism to continue working with 
the Siano driver.

As for the SMS_HOSTLIB_SUBSYS, the Siano driver supports standards which are 
not currently implemented in V4L (i.e. CMMB). I see no reason why we should 
create a duplicate driver for DVB-T and CMMB, if the codebase is exactly the 
same. 

Best regards,
Udi Atar


-Original Message-
From: linux-media-ow...@vger.kernel.org 
[mailto:linux-media-ow...@vger.kernel.org] On Behalf Of Michael Krufky
Sent: Tuesday, May 19, 2009 7:24 PM
To: Uri Shkolnik
Cc: LinuxML; Mauro Carvalho Chehab
Subject: Re: [PATCH] [09051_49] Siano: smscore - upgrade firmware loading engine

On Tue, May 19, 2009 at 11:43 AM, Uri Shkolnik  wrote:
>
> # HG changeset patch
> # User Uri Shkolnik 
> # Date 1242748115 -10800
> # Node ID 4d75f9d1c4f96d65a8ad312c21e488a212ee58a3
> # Parent  cfb4106f3ceaee9fe8f7e3acc9d4adec1baffe5e
> [09051_49] Siano: smscore - upgrade firmware loading engine
>
> From: Uri Shkolnik 
>
> Upgrade the firmware loading (download and switching) engine.
>
> Priority: normal
>
> Signed-off-by: Uri Shkolnik 
>
> diff -r cfb4106f3cea -r 4d75f9d1c4f9 
> linux/drivers/media/dvb/siano/smscoreapi.c
> --- a/linux/drivers/media/dvb/siano/smscoreapi.c        Tue May 19 18:38:07 
> 2009 +0300
> +++ b/linux/drivers/media/dvb/siano/smscoreapi.c        Tue May 19 18:48:35 
> 2009 +0300
> @@ -28,7 +28,7 @@
>  #include 
>  #include 
>  #include 
> -
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -36,7 +36,13 @@
>  #include "smscoreapi.h"
>  #include "sms-cards.h"
>  #include "smsir.h"
> -#include "smsendian.h"
> +#define MAX_GPIO_PIN_NUMBER    31
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10)
> +#define REQUEST_FIRMWARE_SUPPORTED
> +#else
> +#define DEFAULT_FW_FILE_PATH "/lib/firmware"
> +#endif
>
>  static int sms_dbg;
>  module_param_named(debug, sms_dbg, int, 0644);
> @@ -459,8 +465,6 @@ static int smscore_init_ir(struct smscor
>                                msg->msgData[0] = coredev->ir.controller;
>                                msg->msgData[1] = coredev->ir.timeout;
>
> -                               smsendian_handle_tx_message(
> -                                       (struct SmsMsgHdr_ST2 *)msg);
>                                rc = smscore_sendrequest_and_wait(coredev, msg,
>                                                msg->xMsgHeader. msgLength,
>                                                &coredev->ir_init_done);
> @@ -486,12 +490,16 @@ static int smscore_init_ir(struct smscor
>  */
>  int smscore_start_device(struct smscore_device_t *coredev)
>  {
> -       int rc = smscore_set_device_mode(
> -                       coredev, smscore_registry_getmode(coredev->devpath));
> +       int rc;
> +
> +#ifdef REQUEST_FIRMWARE_SUPPORTED
> +       rc = smscore_set_device_mode(coredev, smscore_registry_getmode(
> +                       coredev->devpath));
>        if (rc < 0) {
> -               sms_info("set device mode faile , rc %d", rc);
> +               sms_info("set device mode failed , rc %d", rc);
>                return rc;
>        }
> +#endif
>
>        kmutex_lock(&g_smscore_deviceslock);
>
> @@ -632,11 +640,14 @@ static int smscore_load_firmware_from_fi
>                                           loadfirmware_t loadfirmware_handler)
>  {
>        int rc = -ENOENT;
> +       u8 *fw_buf;
> +       u32 fw_buf_size;
> +
> +#ifdef REQUEST_FIRMWARE_SUPPORTED
>        const struct firmware *fw;
> -       u8 *fw_buffer;
>
> -       if (loadfirmware_handler == NULL && !(coredev->device_flags &
> -                                             SMS_DEVICE_FAMILY2))
> +       if (loadfirmware_handler == NULL && !(coredev->device_flags
> +                       & SMS_DEVICE_FAMILY2))
>                return