Re: [PATCH v5 1/5] rtl2832 ver. 0.5: support for RTL2832 demod
On 07/05/2012 05:54 PM, Mauro Carvalho Chehab wrote: Em 05-07-2012 11:35, Antti Palosaari escreveu: On 07/05/2012 05:32 PM, Mauro Carvalho Chehab wrote: Em 18-05-2012 15:47, Thomas Mair escreveu: +static const int reg_mask[32] = { +0x0001, +0x0003, +0x0007, +0x000f, +0x001f, +0x003f, +0x007f, +0x00ff, +0x01ff, +0x03ff, +0x07ff, +0x0fff, +0x1fff, +0x3fff, +0x7fff, +0x, +0x0001, +0x0003, +0x0007, +0x000f, +0x001f, +0x003f, +0x007f, +0x00ff, +0x01ff, +0x03ff, +0x07ff, +0x0fff, +0x1fff, +0x3fff, +0x7fff, +0x +}; It would be better to use a macro here like: #define REG_MASK(b)((1 ((b) + 1)) -1) Even better, you could use the bitops.h BIT() macro: #define REG_MASK(b)(BIT(b + 1) - 1) I said also that once for Thomas during review but he didn't changed it :) As those findings are minor ones, I'll just apply the patch series and add a patch replacing reg_mask table by a macro like above. Thank you! Have a nice vacation. cheers, poma -- 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 v5 1/5] rtl2832 ver. 0.5: support for RTL2832 demod
Em 18-05-2012 15:47, Thomas Mair escreveu: Changelog for ver. 0.5: - fixed code style and naming errors Changelog for ver. 0.4: - removed statistics as their calculation was wrong - fixed bug in Makefile - indentation and code style improvements Signed-off-by: Thomas Mair thomas.mai...@googlemail.com --- drivers/media/dvb/frontends/Kconfig|7 + drivers/media/dvb/frontends/Makefile |1 + drivers/media/dvb/frontends/rtl2832.c | 823 drivers/media/dvb/frontends/rtl2832.h | 74 +++ drivers/media/dvb/frontends/rtl2832_priv.h | 260 + 5 files changed, 1165 insertions(+), 0 deletions(-) create mode 100644 drivers/media/dvb/frontends/rtl2832.c create mode 100644 drivers/media/dvb/frontends/rtl2832.h create mode 100644 drivers/media/dvb/frontends/rtl2832_priv.h diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index f479834..f7d67d7 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig @@ -432,6 +432,13 @@ config DVB_RTL2830 help Say Y when you want to support this frontend. +config DVB_RTL2832 + tristate Realtek RTL2832 DVB-T + depends on DVB_CORE I2C + default m if DVB_FE_CUSTOMISE + help + Say Y when you want to support this frontend. + comment DVB-C (cable) frontends depends on DVB_CORE diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index b0381dc..2279c5d 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile @@ -98,6 +98,7 @@ obj-$(CONFIG_DVB_IT913X_FE) += it913x-fe.o obj-$(CONFIG_DVB_A8293) += a8293.o obj-$(CONFIG_DVB_TDA10071) += tda10071.o obj-$(CONFIG_DVB_RTL2830) += rtl2830.o +obj-$(CONFIG_DVB_RTL2832) += rtl2832.o obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o obj-$(CONFIG_DVB_AF9033) += af9033.o diff --git a/drivers/media/dvb/frontends/rtl2832.c b/drivers/media/dvb/frontends/rtl2832.c new file mode 100644 index 000..d0cbe27 --- /dev/null +++ b/drivers/media/dvb/frontends/rtl2832.c @@ -0,0 +1,823 @@ +/* + * Realtek RTL2832 DVB-T demodulator driver + * + * Copyright (C) 2012 Thomas Mair thomas.mai...@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; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include rtl2832_priv.h + + +int rtl2832_debug; +module_param_named(debug, rtl2832_debug, int, 0644); +MODULE_PARM_DESC(debug, Turn on/off frontend debugging (default:off).); + + +static const int reg_mask[32] = { + 0x0001, + 0x0003, + 0x0007, + 0x000f, + 0x001f, + 0x003f, + 0x007f, + 0x00ff, + 0x01ff, + 0x03ff, + 0x07ff, + 0x0fff, + 0x1fff, + 0x3fff, + 0x7fff, + 0x, + 0x0001, + 0x0003, + 0x0007, + 0x000f, + 0x001f, + 0x003f, + 0x007f, + 0x00ff, + 0x01ff, + 0x03ff, + 0x07ff, + 0x0fff, + 0x1fff, + 0x3fff, + 0x7fff, + 0x +}; It would be better to use a macro here like: #define REG_MASK(b) ((1 ((b) + 1)) -1) Even better, you could use the bitops.h BIT() macro: #define REG_MASK(b) (BIT(b + 1) - 1) + +static const struct rtl2832_reg_entry registers[] = { + [DVBT_SOFT_RST] = {0x1, 0x1, 2, 2}, + [DVBT_IIC_REPEAT] = {0x1, 0x1, 3, 3}, + [DVBT_TR_WAIT_MIN_8K] = {0x1, 0x88, 11, 2}, + [DVBT_RSD_BER_FAIL_VAL] = {0x1, 0x8f, 15, 0}, + [DVBT_EN_BK_TRK]= {0x1, 0xa6, 7, 7}, + [DVBT_AD_EN_REG]= {0x0, 0x8, 7, 7}, + [DVBT_AD_EN_REG1] = {0x0, 0x8, 6, 6}, + [DVBT_EN_BBIN] = {0x1, 0xb1, 0, 0}, + [DVBT_MGD_THD0] = {0x1, 0x95, 7, 0}, + [DVBT_MGD_THD1] = {0x1, 0x96, 7, 0}, + [DVBT_MGD_THD2] = {0x1, 0x97, 7, 0}, + [DVBT_MGD_THD3] = {0x1, 0x98, 7, 0}, + [DVBT_MGD_THD4] = {0x1, 0x99, 7, 0}, + [DVBT_MGD_THD5] = {0x1, 0x9a, 7, 0}, + [DVBT_MGD_THD6] = {0x1, 0x9b, 7, 0}, +
Re: [PATCH v5 1/5] rtl2832 ver. 0.5: support for RTL2832 demod
On 07/05/2012 05:32 PM, Mauro Carvalho Chehab wrote: Em 18-05-2012 15:47, Thomas Mair escreveu: Changelog for ver. 0.5: - fixed code style and naming errors Changelog for ver. 0.4: - removed statistics as their calculation was wrong - fixed bug in Makefile - indentation and code style improvements Signed-off-by: Thomas Mair thomas.mai...@googlemail.com --- drivers/media/dvb/frontends/Kconfig|7 + drivers/media/dvb/frontends/Makefile |1 + drivers/media/dvb/frontends/rtl2832.c | 823 drivers/media/dvb/frontends/rtl2832.h | 74 +++ drivers/media/dvb/frontends/rtl2832_priv.h | 260 + 5 files changed, 1165 insertions(+), 0 deletions(-) create mode 100644 drivers/media/dvb/frontends/rtl2832.c create mode 100644 drivers/media/dvb/frontends/rtl2832.h create mode 100644 drivers/media/dvb/frontends/rtl2832_priv.h diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index f479834..f7d67d7 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig @@ -432,6 +432,13 @@ config DVB_RTL2830 help Say Y when you want to support this frontend. +config DVB_RTL2832 + tristate Realtek RTL2832 DVB-T + depends on DVB_CORE I2C + default m if DVB_FE_CUSTOMISE + help + Say Y when you want to support this frontend. + comment DVB-C (cable) frontends depends on DVB_CORE diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index b0381dc..2279c5d 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile @@ -98,6 +98,7 @@ obj-$(CONFIG_DVB_IT913X_FE) += it913x-fe.o obj-$(CONFIG_DVB_A8293) += a8293.o obj-$(CONFIG_DVB_TDA10071) += tda10071.o obj-$(CONFIG_DVB_RTL2830) += rtl2830.o +obj-$(CONFIG_DVB_RTL2832) += rtl2832.o obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o obj-$(CONFIG_DVB_AF9033) += af9033.o diff --git a/drivers/media/dvb/frontends/rtl2832.c b/drivers/media/dvb/frontends/rtl2832.c new file mode 100644 index 000..d0cbe27 --- /dev/null +++ b/drivers/media/dvb/frontends/rtl2832.c @@ -0,0 +1,823 @@ +/* + * Realtek RTL2832 DVB-T demodulator driver + * + * Copyright (C) 2012 Thomas Mair thomas.mai...@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; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include rtl2832_priv.h + + +int rtl2832_debug; +module_param_named(debug, rtl2832_debug, int, 0644); +MODULE_PARM_DESC(debug, Turn on/off frontend debugging (default:off).); + + +static const int reg_mask[32] = { + 0x0001, + 0x0003, + 0x0007, + 0x000f, + 0x001f, + 0x003f, + 0x007f, + 0x00ff, + 0x01ff, + 0x03ff, + 0x07ff, + 0x0fff, + 0x1fff, + 0x3fff, + 0x7fff, + 0x, + 0x0001, + 0x0003, + 0x0007, + 0x000f, + 0x001f, + 0x003f, + 0x007f, + 0x00ff, + 0x01ff, + 0x03ff, + 0x07ff, + 0x0fff, + 0x1fff, + 0x3fff, + 0x7fff, + 0x +}; It would be better to use a macro here like: #define REG_MASK(b) ((1 ((b) + 1)) -1) Even better, you could use the bitops.h BIT() macro: #define REG_MASK(b) (BIT(b + 1) - 1) I said also that once for Thomas during review but he didn't changed it :) + +static const struct rtl2832_reg_entry registers[] = { + [DVBT_SOFT_RST] = {0x1, 0x1, 2, 2}, + [DVBT_IIC_REPEAT] = {0x1, 0x1, 3, 3}, + [DVBT_TR_WAIT_MIN_8K] = {0x1, 0x88, 11, 2}, + [DVBT_RSD_BER_FAIL_VAL] = {0x1, 0x8f, 15, 0}, + [DVBT_EN_BK_TRK]= {0x1, 0xa6, 7, 7}, + [DVBT_AD_EN_REG]= {0x0, 0x8, 7, 7}, + [DVBT_AD_EN_REG1] = {0x0, 0x8, 6, 6}, + [DVBT_EN_BBIN] = {0x1, 0xb1, 0, 0}, + [DVBT_MGD_THD0] = {0x1, 0x95, 7, 0}, + [DVBT_MGD_THD1] = {0x1, 0x96, 7, 0}, + [DVBT_MGD_THD2] = {0x1, 0x97, 7, 0}, + [DVBT_MGD_THD3] = {0x1, 0x98, 7, 0}, + [DVBT_MGD_THD4] = {0x1,
Re: [PATCH v5 1/5] rtl2832 ver. 0.5: support for RTL2832 demod
On 07/05/2012 05:32 PM, Mauro Carvalho Chehab wrote: Em 18-05-2012 15:47, Thomas Mair escreveu: +static int rtl2832_read_signal_strength(struct dvb_frontend *fe, u16 *strength) +{ + *strength = 0; + return 0; +} Why to implement the above, if they're doing nothing? Other your findings were correct but for that I would like to comment. Have you ever tested what happens you lest those without stub implementation? IIRC ugly errors are seen for example zap and femon outputs. Some kind of DVB-core changes are needed. And IIRC there was some error code defined too for API - but such code does not exists. regards Antti -- http://palosaari.fi/ -- 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 v5 1/5] rtl2832 ver. 0.5: support for RTL2832 demod
Em 05-07-2012 11:41, Antti Palosaari escreveu: On 07/05/2012 05:32 PM, Mauro Carvalho Chehab wrote: Em 18-05-2012 15:47, Thomas Mair escreveu: +static int rtl2832_read_signal_strength(struct dvb_frontend *fe, u16 *strength) +{ +*strength = 0; +return 0; +} Why to implement the above, if they're doing nothing? Other your findings were correct but for that I would like to comment. Have you ever tested what happens you lest those without stub implementation? IIRC ugly errors are seen for example zap and femon outputs. Some kind of DVB-core changes are needed. And IIRC there was some error code defined too for API - but such code does not exists. So, let's fix the dvb_core, and not fill drivers with stubs. With regards to userspace tools, they should be patched to accept the error code that signalizes that an ioctl was not implemented, and not try to fix an userpace issue in Kernel. 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 v5 1/5] rtl2832 ver. 0.5: support for RTL2832 demod
Em 05-07-2012 11:35, Antti Palosaari escreveu: On 07/05/2012 05:32 PM, Mauro Carvalho Chehab wrote: Em 18-05-2012 15:47, Thomas Mair escreveu: +static const int reg_mask[32] = { +0x0001, +0x0003, +0x0007, +0x000f, +0x001f, +0x003f, +0x007f, +0x00ff, +0x01ff, +0x03ff, +0x07ff, +0x0fff, +0x1fff, +0x3fff, +0x7fff, +0x, +0x0001, +0x0003, +0x0007, +0x000f, +0x001f, +0x003f, +0x007f, +0x00ff, +0x01ff, +0x03ff, +0x07ff, +0x0fff, +0x1fff, +0x3fff, +0x7fff, +0x +}; It would be better to use a macro here like: #define REG_MASK(b)((1 ((b) + 1)) -1) Even better, you could use the bitops.h BIT() macro: #define REG_MASK(b)(BIT(b + 1) - 1) I said also that once for Thomas during review but he didn't changed it :) As those findings are minor ones, I'll just apply the patch series and add a patch replacing reg_mask table by a macro like above. +static int rtl2832_read_signal_strength(struct dvb_frontend *fe, u16 *strength) +{ +*strength = 0; +return 0; +} Why to implement the above, if they're doing nothing? Other your findings were correct but for that I would like to comment. Have you ever tested what happens you lest those without stub implementation? IIRC ugly errors are seen for example zap and femon outputs. Some kind of DVB-core changes are needed. And IIRC there was some error code defined too for API - but such code does not exists. I'll keep those stubs for now, but we should really fix the core and not allow/add crap things like that. 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
[PATCH v5 1/5] rtl2832 ver. 0.5: support for RTL2832 demod
Changelog for ver. 0.5: - fixed code style and naming errors Changelog for ver. 0.4: - removed statistics as their calculation was wrong - fixed bug in Makefile - indentation and code style improvements Signed-off-by: Thomas Mair thomas.mai...@googlemail.com --- drivers/media/dvb/frontends/Kconfig|7 + drivers/media/dvb/frontends/Makefile |1 + drivers/media/dvb/frontends/rtl2832.c | 823 drivers/media/dvb/frontends/rtl2832.h | 74 +++ drivers/media/dvb/frontends/rtl2832_priv.h | 260 + 5 files changed, 1165 insertions(+), 0 deletions(-) create mode 100644 drivers/media/dvb/frontends/rtl2832.c create mode 100644 drivers/media/dvb/frontends/rtl2832.h create mode 100644 drivers/media/dvb/frontends/rtl2832_priv.h diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index f479834..f7d67d7 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig @@ -432,6 +432,13 @@ config DVB_RTL2830 help Say Y when you want to support this frontend. +config DVB_RTL2832 + tristate Realtek RTL2832 DVB-T + depends on DVB_CORE I2C + default m if DVB_FE_CUSTOMISE + help + Say Y when you want to support this frontend. + comment DVB-C (cable) frontends depends on DVB_CORE diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index b0381dc..2279c5d 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile @@ -98,6 +98,7 @@ obj-$(CONFIG_DVB_IT913X_FE) += it913x-fe.o obj-$(CONFIG_DVB_A8293) += a8293.o obj-$(CONFIG_DVB_TDA10071) += tda10071.o obj-$(CONFIG_DVB_RTL2830) += rtl2830.o +obj-$(CONFIG_DVB_RTL2832) += rtl2832.o obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o obj-$(CONFIG_DVB_AF9033) += af9033.o diff --git a/drivers/media/dvb/frontends/rtl2832.c b/drivers/media/dvb/frontends/rtl2832.c new file mode 100644 index 000..d0cbe27 --- /dev/null +++ b/drivers/media/dvb/frontends/rtl2832.c @@ -0,0 +1,823 @@ +/* + * Realtek RTL2832 DVB-T demodulator driver + * + * Copyright (C) 2012 Thomas Mair thomas.mai...@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; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include rtl2832_priv.h + + +int rtl2832_debug; +module_param_named(debug, rtl2832_debug, int, 0644); +MODULE_PARM_DESC(debug, Turn on/off frontend debugging (default:off).); + + +static const int reg_mask[32] = { + 0x0001, + 0x0003, + 0x0007, + 0x000f, + 0x001f, + 0x003f, + 0x007f, + 0x00ff, + 0x01ff, + 0x03ff, + 0x07ff, + 0x0fff, + 0x1fff, + 0x3fff, + 0x7fff, + 0x, + 0x0001, + 0x0003, + 0x0007, + 0x000f, + 0x001f, + 0x003f, + 0x007f, + 0x00ff, + 0x01ff, + 0x03ff, + 0x07ff, + 0x0fff, + 0x1fff, + 0x3fff, + 0x7fff, + 0x +}; + +static const struct rtl2832_reg_entry registers[] = { + [DVBT_SOFT_RST] = {0x1, 0x1, 2, 2}, + [DVBT_IIC_REPEAT] = {0x1, 0x1, 3, 3}, + [DVBT_TR_WAIT_MIN_8K] = {0x1, 0x88, 11, 2}, + [DVBT_RSD_BER_FAIL_VAL] = {0x1, 0x8f, 15, 0}, + [DVBT_EN_BK_TRK]= {0x1, 0xa6, 7, 7}, + [DVBT_AD_EN_REG]= {0x0, 0x8, 7, 7}, + [DVBT_AD_EN_REG1] = {0x0, 0x8, 6, 6}, + [DVBT_EN_BBIN] = {0x1, 0xb1, 0, 0}, + [DVBT_MGD_THD0] = {0x1, 0x95, 7, 0}, + [DVBT_MGD_THD1] = {0x1, 0x96, 7, 0}, + [DVBT_MGD_THD2] = {0x1, 0x97, 7, 0}, + [DVBT_MGD_THD3] = {0x1, 0x98, 7, 0}, + [DVBT_MGD_THD4] = {0x1, 0x99, 7, 0}, + [DVBT_MGD_THD5] = {0x1, 0x9a, 7, 0}, + [DVBT_MGD_THD6] = {0x1, 0x9b, 7, 0}, + [DVBT_MGD_THD7] = {0x1, 0x9c, 7, 0}, + [DVBT_EN_CACQ_NOTCH]= {0x1, 0x61, 4, 4}, + [DVBT_AD_AV_REF]= {0x0, 0x9, 6, 0}, + [DVBT_REG_PI] = {0x0, 0xa, 2, 0}, + [DVBT_PIP_ON] = {0x0, 0x21, 3, 3}, +
Re: [PATCH v5 1/5] rtl2832 ver. 0.5: support for RTL2832 demod
On 18.05.2012 21:47, Thomas Mair wrote: Changelog for ver. 0.5: - fixed code style and naming errors Changelog for ver. 0.4: - removed statistics as their calculation was wrong - fixed bug in Makefile - indentation and code style improvements Signed-off-by: Thomas Mairthomas.mai...@googlemail.com Reviewed-by: Antti Palosaari cr...@iki.fi Seems to be correct! regards Antti -- http://palosaari.fi/ -- 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