[PATCH 1/2] [media] drxk: Make the QAM demodulator command configurable.

2012-06-29 Thread Ralph Metzler
Martin Blumenstingl writes:
  Currently there are two different commands: the old command which takes
  4 parameters, and a newer one with just takes 2 parameters.

Hi,

are you sure about this?
From what I have been told, the 2 parameter command is in the 
firmware ROM and older loadable/patch firmwares.
Newer firmwares provided the 4 parameter command.

Regards,
Ralph

--
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 1/2] [media] drxk: Make the QAM demodulator command configurable.

2012-06-29 Thread Mauro Carvalho Chehab
Em 29-06-2012 12:58, Martin Blumenstingl escreveu:
 Hi Ralph,
 
 are you sure about this?
  From what I have been told, the 2 parameter command is in the
 firmware ROM and older loadable/patch firmwares.
 Newer firmwares provided the 4 parameter command.
 The firmwares in the ROM are a good point.
 
 I discussed with  Mauro Carvalho Chehab before I started writing my patch,
 and he told me that the only (loadable) firmware that uses the old command
 is the drxk_a3.mc one.

 But you are right, there is some firmware (for DVB-C, afaik it's NOT for 
 DVB-T)
 stored in the ROM.
 
 If  I find out that the ROM uses the old command then I'll probably try
 making this smart:
 old_qam_demod_cmd will be an int with the following possible values:
 * -1: unknown - trial and error approach will be used
 (afterwards this will be updated to either 0 or 1)
 * 0: use the 2-parameter command
 * 1: use the 4-parameter command
 
 I'll also try to guess a smart default value:
 -1 will be used if no firmware was given.
 Otherwise 0 will be the default.
 The remaining two drxk_config instances that are still using the old
 firmware will be set to 1 (like in my first patch).

I didn't tell old command, or at least not in the sense of old firmware. I 
told
that the first drivers (ddbridge and mantis), based on drxk_ac3.mc firmware, 
use the
4-parameters variant, while the other drivers use the 2-parameters variant.

Anyway, using the name old for such parameter is not a good idea. IMHO, you
should use something like qam_demod_needs_4_parameters for this config data,
or, maybe number_of_qam_demod_parameters.

If number_of_qam_demod_parameters is not 2 or 4, try both ways. So, a device 
driver
that won't specify it will be auto-probed.

 
 If everything goes right then I'll be able to test and update my patch 
 tonight.
 
 Regards,
 Martin
 --
 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
 

Regards,
Mauro
--
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 1/2] [media] drxk: Make the QAM demodulator command configurable.

2012-06-29 Thread Martin Blumenstingl
Hi,

 I didn't tell old command, or at least not in the sense of old firmware. I 
 told
 that the first drivers (ddbridge and mantis), based on drxk_ac3.mc firmware, 
 use the
 4-parameters variant, while the other drivers use the 2-parameters variant.
Oh sorry, I must have gotten that wrong.

 Anyway, using the name old for such parameter is not a good idea. IMHO, you
 should use something like qam_demod_needs_4_parameters for this config data,
 or, maybe number_of_qam_demod_parameters.
Sounds good.

 If number_of_qam_demod_parameters is not 2 or 4, try both ways. So, a device 
 driver
 that won't specify it will be auto-probed.
Ok, I'll keep the existing order:
- first try the 4-parameter one
- then try the 2-parameter one
And I'll update the variable then to make sure we're not doing that
trial-and-error thing
twice.

I'll also update all drxk_config instances where I'm sure that they're
using the (newer)
2-parameter method.

Thanks you two for you feedback!

Regards,
Martin
--
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 1/2] [media] drxk: Make the QAM demodulator command configurable.

2012-06-28 Thread Martin Blumenstingl
Currently there are two different commands: the old command which takes
4 parameters, and a newer one with just takes 2 parameters.
The driver shows an error in dmesg When using the old command with a new
firmware. Unfortunately this happens every time when chaning the
frequency (on DVB-C).

This patch simply makes configurable, whether the old or the new command
will be used.
All existing drxk_config instances using the drxk_a3.mc are updated to
make sure that these won't break (as this is the only firmware that uses
the old command).

I also removed a few lines of duplicated code.

Signed-off-by: Martin Blumenstingl martin.blumensti...@googlemail.com
---
 drivers/media/dvb/ddbridge/ddbridge-core.c |  1 +
 drivers/media/dvb/frontends/drxk.h |  6 +++-
 drivers/media/dvb/frontends/drxk_hard.c| 44 ++
 drivers/media/dvb/frontends/drxk_hard.h|  3 +-
 drivers/media/dvb/ngene/ngene-cards.c  |  1 +
 5 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/drivers/media/dvb/ddbridge/ddbridge-core.c 
b/drivers/media/dvb/ddbridge/ddbridge-core.c
index 131b938..80985bb 100644
--- a/drivers/media/dvb/ddbridge/ddbridge-core.c
+++ b/drivers/media/dvb/ddbridge/ddbridge-core.c
@@ -578,6 +578,7 @@ static int demod_attach_drxk(struct ddb_input *input)
 
memset(config, 0, sizeof(config));
config.microcode_name = drxk_a3.mc;
+   config.old_qam_demod_cmd = true;
config.adr = 0x29 + (input-nr  1);
 
fe = input-fe = dvb_attach(drxk_attach, config, i2c);
diff --git a/drivers/media/dvb/frontends/drxk.h 
b/drivers/media/dvb/frontends/drxk.h
index 9d64e4f..c718530 100644
--- a/drivers/media/dvb/frontends/drxk.h
+++ b/drivers/media/dvb/frontends/drxk.h
@@ -20,6 +20,9 @@
  * means that 1=DVBC, 0 = DVBT. Zero means the opposite.
  * @mpeg_out_clk_strength: DRXK Mpeg output clock drive strength.
  * @microcode_name:Name of the firmware file with the microcode
+ * @old_qam_demod_cmd: True if the firmware uses the old (4-parameter)
+ * version of the command to set the demodulator params.
+ * Only the initial firmware (drxk_a3.mc) use this.
  *
  * On the *_gpio vars, bit 0 is UIO-1, bit 1 is UIO-2 and bit 2 is
  * UIO-3.
@@ -38,7 +41,8 @@ struct drxk_config {
u8  mpeg_out_clk_strength;
int chunk_size;
 
-   const char *microcode_name;
+   const char  *microcode_name;
+   boolold_qam_demod_cmd;
 };
 
 #if defined(CONFIG_DVB_DRXK) || (defined(CONFIG_DVB_DRXK_MODULE) \
diff --git a/drivers/media/dvb/frontends/drxk_hard.c 
b/drivers/media/dvb/frontends/drxk_hard.c
index 60b868f..9b4d28c 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -5445,34 +5445,43 @@ static int SetQAM(struct drxk_state *state, u16 
IntermediateFreqkHz,
}
if (status  0)
goto error;
+
setParamParameters[0] = state-m_Constellation; /* modulation */
setParamParameters[1] = DRXK_QAM_I12_J17;   /* interleave mode   */
-   if (state-m_OperationMode == OM_QAM_ITU_C)
-   setParamParameters[2] = QAM_TOP_ANNEX_C;
-   else
-   setParamParameters[2] = QAM_TOP_ANNEX_A;
-   setParamParameters[3] |= (QAM_MIRROR_AUTO_ON);
-   /* Env parameters */
-   /* check for LOCKRANGE Extented */
-   /* setParamParameters[3] |= QAM_LOCKRANGE_NORMAL; */
 
-   status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | 
SCU_RAM_COMMAND_CMD_DEMOD_SET_PARAM, 4, setParamParameters, 1, cmdResult);
-   if (status  0) {
-   /* Fall-back to the simpler call */
+   if (state-old_qam_demod_cmd) {
if (state-m_OperationMode == OM_QAM_ITU_C)
-   setParamParameters[0] = QAM_TOP_ANNEX_C;
+   setParamParameters[2] = QAM_TOP_ANNEX_C;
else
-   setParamParameters[0] = QAM_TOP_ANNEX_A;
-   status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | 
SCU_RAM_COMMAND_CMD_DEMOD_SET_ENV, 1, setParamParameters, 1, cmdResult);
+   setParamParameters[2] = QAM_TOP_ANNEX_A;
+   setParamParameters[3] |= (QAM_MIRROR_AUTO_ON);
+   /* Env parameters */
+   /* check for LOCKRANGE Extented */
+   /* setParamParameters[3] |= QAM_LOCKRANGE_NORMAL; */
+
+   status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | 
SCU_RAM_COMMAND_CMD_DEMOD_SET_PARAM, 4, setParamParameters, 1, cmdResult);
+   } else {
+   u16 setEnvParameters[1];
+
+   if (state-m_OperationMode == OM_QAM_ITU_C)
+   setEnvParameters[0] = QAM_TOP_ANNEX_C;
+   else
+   setEnvParameters[0] = QAM_TOP_ANNEX_A;
+
+   status = scu_command(state, SCU_RAM_COMMAND_STANDARD_QAM | 
SCU_RAM_COMMAND_CMD_DEMOD_SET_ENV, 1,