Re: [PATCH] [RESEND] media: tea5764: reconcile Kconfig symbol and macro

2011-11-03 Thread Mauro Carvalho Chehab
Em 30-10-2011 15:31, Paul Bolle escreveu:
 On Sun, 2011-10-30 at 10:24 -0700, Randy Dunlap wrote:
 On 10/30/11 10:12, Paul Bolle wrote:
 2) I'm not sure why things are done that way. Why can't builtin drivers
 and loadable drivers default to identical values? But perhaps I'm just
 misunderstanding the code.

 They could default to identical values.
 
 That would make the cleaning up I'm trying to do now somewhat easier. It
 would allow to simplify the drivers a bit too.
 
 Maybe someone thinks that
 it's more difficult to pass parameters to builtin drivers so they
 just try to use some sane defaults for them instead, whereas it's
 easy (easier) to pass parameters to loadable modules.  ??
 
 Perhaps Mauro or the people at linux-media know the reasoning here. Or
 they can show us that I didn't parse the code correctly, of course.

I can't remember the dirty details about this driver, sorry. The first
patch on it might shed some light:


commit 46a60cfef581307d8273919182ae939d44ff7cca
Author: Fabio Belavenuto belaven...@gmail.com
Date:   Tue Dec 30 19:27:09 2008 -0300

V4L/DVB (10155): Add TEA5764 radio driver

Add support for radio driver TEA5764 from NXP.
This chip is connected in pxa I2C bus in EZX phones
from Motorola, the chip is used in phone model A1200.
This driver is for OpenEZX project (www.openezx.org)
Tested with A1200 phone, openezx kernel and fm-tools

[mche...@redhat.com: Fixed CodingStyle and solved some merge conflicts]
Signed-off-by: Fabio Belavenuto belaven...@gmail.com
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

From the above, I _suspect_ that the default (whatever it is) is due to
the Motorola A1200 phone. Not sure if it is compiled as module or as builtin
at OpenEZX.


 
 
 Paul Bolle
 
 --
 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] [RESEND] media: tea5764: reconcile Kconfig symbol and macro

2011-10-30 Thread Paul Bolle
The Kconfig symbol RADIO_TEA5764_XTAL is unused. The code does use a
RADIO_TEA5764_XTAL macro, but does that rather peculiar. But there seems
to be a way to keep both. (The easiest way out would be to rip out both
the Kconfig symbol and the macro.)

Note there's also a module parameter 'use_xtal' to influence all this.

Signed-off-by: Paul Bolle pebo...@tiscali.nl
---
I didn't dare to submit this a trivial patch. This is still untested. By
the way, is xtal a common abbreviation of crystal?

 drivers/media/radio/radio-tea5764.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/radio/radio-tea5764.c 
b/drivers/media/radio/radio-tea5764.c
index 95ddcc4..db20904 100644
--- a/drivers/media/radio/radio-tea5764.c
+++ b/drivers/media/radio/radio-tea5764.c
@@ -128,8 +128,10 @@ struct tea5764_write_regs {
u16 rdsbbl; /* PAUSEDET  RDSBBL */
 } __attribute__ ((packed));
 
-#ifndef RADIO_TEA5764_XTAL
+#ifdef CONFIG_RADIO_TEA5764_XTAL
 #define RADIO_TEA5764_XTAL 1
+#else
+#define RADIO_TEA5764_XTAL 0
 #endif
 
 static int radio_nr = -1;
-- 
1.7.4.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


Re: [PATCH] [RESEND] media: tea5764: reconcile Kconfig symbol and macro

2011-10-30 Thread Randy Dunlap
On 10/30/11 05:08, Paul Bolle wrote:
 The Kconfig symbol RADIO_TEA5764_XTAL is unused. The code does use a
 RADIO_TEA5764_XTAL macro, but does that rather peculiar. But there seems
 to be a way to keep both. (The easiest way out would be to rip out both
 the Kconfig symbol and the macro.)
 
 Note there's also a module parameter 'use_xtal' to influence all this.

It's curious that the module parameter is only available when the driver
is builtin (=y) but not built as a loadable module (=m):

config RADIO_TEA5764_XTAL
bool TEA5764 crystal reference
depends on RADIO_TEA5764=y
default y

 
 Signed-off-by: Paul Bolle pebo...@tiscali.nl
 ---
 I didn't dare to submit this a trivial patch. This is still untested. By
 the way, is xtal a common abbreviation of crystal?

Yes, it is.

Acked-by: Randy Dunlap rdun...@xenotime.net

Thanks.

  drivers/media/radio/radio-tea5764.c |4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/media/radio/radio-tea5764.c 
 b/drivers/media/radio/radio-tea5764.c
 index 95ddcc4..db20904 100644
 --- a/drivers/media/radio/radio-tea5764.c
 +++ b/drivers/media/radio/radio-tea5764.c
 @@ -128,8 +128,10 @@ struct tea5764_write_regs {
   u16 rdsbbl; /* PAUSEDET  RDSBBL */
  } __attribute__ ((packed));
  
 -#ifndef RADIO_TEA5764_XTAL
 +#ifdef CONFIG_RADIO_TEA5764_XTAL
  #define RADIO_TEA5764_XTAL 1
 +#else
 +#define RADIO_TEA5764_XTAL 0
  #endif
  
  static int radio_nr = -1;


-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
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] [RESEND] media: tea5764: reconcile Kconfig symbol and macro

2011-10-30 Thread Paul Bolle
On Sun, 2011-10-30 at 09:43 -0700, Randy Dunlap wrote:
 On 10/30/11 05:08, Paul Bolle wrote:
  The Kconfig symbol RADIO_TEA5764_XTAL is unused. The code does use a
  RADIO_TEA5764_XTAL macro, but does that rather peculiar. But there seems
  to be a way to keep both. (The easiest way out would be to rip out both
  the Kconfig symbol and the macro.)
  
  Note there's also a module parameter 'use_xtal' to influence all this.
 
 It's curious that the module parameter is only available when the driver
 is builtin (=y) but not built as a loadable module (=m):

As far as I can see the module parameter is available in both cases but
defaults to different values when builtin and when loadable. 

 config RADIO_TEA5764_XTAL
   bool TEA5764 crystal reference
   depends on RADIO_TEA5764=y
   default y

0) I've noticed similar dependencies (while doing some other Kconfig
related clean up) with a number of other config entries in that same
Kconfig file:
$ git grep -n depends on.*=y drivers/media/radio/
drivers/media/radio/Kconfig:60: depends on RADIO_RTRACK=y
drivers/media/radio/Kconfig:83: depends on RADIO_RTRACK2=y
drivers/media/radio/Kconfig:106:depends on RADIO_AZTECH=y
drivers/media/radio/Kconfig:135:depends on RADIO_GEMTEK=y
drivers/media/radio/Kconfig:147:depends on RADIO_GEMTEK=y
drivers/media/radio/Kconfig:239:depends on RADIO_TERRATEC=y
drivers/media/radio/Kconfig:257:depends on RADIO_TRUST=y
drivers/media/radio/Kconfig:280:depends on RADIO_TYPHOON=y
drivers/media/radio/Kconfig:287:depends on RADIO_TYPHOON=y
drivers/media/radio/Kconfig:314:depends on RADIO_ZOLTRIX=y
drivers/media/radio/Kconfig:385:depends on RADIO_TEA5764=y 

1) It seems the logic behind those config symbols is mostly like this:
- if the driver for a radio is builtin: default some setting for that
  radio to a sane value, but allow overriding of that setting on the
  kernel commandline (through a module parameter)
- if the driver for a radio is a module: default that same setting to
  something invalid and _force_ the use of module parameters to get a
  sane value

This logic isn't implemented flawless but it does look to me that this
is intentional.

2) I'm not sure why things are done that way. Why can't builtin drivers
and loadable drivers default to identical values? But perhaps I'm just
misunderstanding the code.


Paul Bolle

--
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] [RESEND] media: tea5764: reconcile Kconfig symbol and macro

2011-10-30 Thread Randy Dunlap
On 10/30/11 10:12, Paul Bolle wrote:
 On Sun, 2011-10-30 at 09:43 -0700, Randy Dunlap wrote:
 On 10/30/11 05:08, Paul Bolle wrote:
 The Kconfig symbol RADIO_TEA5764_XTAL is unused. The code does use a
 RADIO_TEA5764_XTAL macro, but does that rather peculiar. But there seems
 to be a way to keep both. (The easiest way out would be to rip out both
 the Kconfig symbol and the macro.)

 Note there's also a module parameter 'use_xtal' to influence all this.

 It's curious that the module parameter is only available when the driver
 is builtin (=y) but not built as a loadable module (=m):
 
 As far as I can see the module parameter is available in both cases but
 defaults to different values when builtin and when loadable. 

Ah, you are correct.  Thanks.

 config RADIO_TEA5764_XTAL
  bool TEA5764 crystal reference
  depends on RADIO_TEA5764=y
  default y
 
 0) I've noticed similar dependencies (while doing some other Kconfig
 related clean up) with a number of other config entries in that same
 Kconfig file:
 $ git grep -n depends on.*=y drivers/media/radio/
 drivers/media/radio/Kconfig:60: depends on RADIO_RTRACK=y
 drivers/media/radio/Kconfig:83: depends on RADIO_RTRACK2=y
 drivers/media/radio/Kconfig:106:depends on RADIO_AZTECH=y
 drivers/media/radio/Kconfig:135:depends on RADIO_GEMTEK=y
 drivers/media/radio/Kconfig:147:depends on RADIO_GEMTEK=y
 drivers/media/radio/Kconfig:239:depends on RADIO_TERRATEC=y
 drivers/media/radio/Kconfig:257:depends on RADIO_TRUST=y
 drivers/media/radio/Kconfig:280:depends on RADIO_TYPHOON=y
 drivers/media/radio/Kconfig:287:depends on RADIO_TYPHOON=y
 drivers/media/radio/Kconfig:314:depends on RADIO_ZOLTRIX=y
 drivers/media/radio/Kconfig:385:depends on RADIO_TEA5764=y 
 
 1) It seems the logic behind those config symbols is mostly like this:
 - if the driver for a radio is builtin: default some setting for that
   radio to a sane value, but allow overriding of that setting on the
   kernel commandline (through a module parameter)
 - if the driver for a radio is a module: default that same setting to
   something invalid and _force_ the use of module parameters to get a
   sane value
 
 This logic isn't implemented flawless but it does look to me that this
 is intentional.
 
 2) I'm not sure why things are done that way. Why can't builtin drivers
 and loadable drivers default to identical values? But perhaps I'm just
 misunderstanding the code.

They could default to identical values.  Maybe someone thinks that
it's more difficult to pass parameters to builtin drivers so they
just try to use some sane defaults for them instead, whereas it's
easy (easier) to pass parameters to loadable modules.  ??


-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
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] [RESEND] media: tea5764: reconcile Kconfig symbol and macro

2011-10-30 Thread Paul Bolle
On Sun, 2011-10-30 at 10:24 -0700, Randy Dunlap wrote:
 On 10/30/11 10:12, Paul Bolle wrote:
  2) I'm not sure why things are done that way. Why can't builtin drivers
  and loadable drivers default to identical values? But perhaps I'm just
  misunderstanding the code.
 
 They could default to identical values.

That would make the cleaning up I'm trying to do now somewhat easier. It
would allow to simplify the drivers a bit too.

 Maybe someone thinks that
 it's more difficult to pass parameters to builtin drivers so they
 just try to use some sane defaults for them instead, whereas it's
 easy (easier) to pass parameters to loadable modules.  ??

Perhaps Mauro or the people at linux-media know the reasoning here. Or
they can show us that I didn't parse the code correctly, of course.


Paul Bolle

--
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