Re: [PATCH V2] media: s5p_mfc: Release ctx-ctx if failed to allocate ctx-shm
Hi, On 08/05/2014 06:31 PM, Zhaowei Yuan wrote: ctx-ctx should be released if the following allocation for ctx-shm gets failed. Signed-off-by: Zhaowei Yuan zhaowei.y...@samsung.com --- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c |1 + 1 file changed, 1 insertion(+) mode change 100644 = 100755 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c It's wrong to change file permission, please don't make a same mistake. -- 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] media: s5p_mfc_dec: delete the redundant code
Hi, On 08/01/2014 06:15 PM, panpan liu wrote: Because the api s5p_mfc_queue_setup has already realized the same function Signed-off-by: panpan liu panpan1@samsung.com --- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c |9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -544,14 +544,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, mfc_err(vb2_reqbufs on capture failed\n); return ret; } - if (reqbufs-count ctx-pb_count) { - mfc_err(Not enough buffers allocated\n); - reqbufs-count = 0; - s5p_mfc_clock_on(); - ret = vb2_reqbufs(ctx-vq_dst, reqbufs); - s5p_mfc_clock_off(); - return -ENOMEM; - } + As Hans said, you should always check the latest upstream kernel. Why do you post patches based on old kernel at ML continuously? -- 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] media: s5p_mfc: remove unnecessary calling to function video_devdata()
Hi Zhaowei, On 07/23/2014 09:49 AM, Zhaowei Yuan wrote: Since we have get vdev by calling video_devdata() at the beginning of s5p_mfc_open(), we should just use vdev instead of calling video_devdata() again in the following code. Change-Id: I869051762d33b50a7c0dbc8149b072e70b89c6b9 Please don't put this in patch when you submit at upstream. Change-Id means nothing to us. Signed-off-by: Zhaowei Yuan zhaowei.y...@samsung.com --- drivers/media/platform/s5p-mfc/s5p_mfc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index d57b306..d508cbc 100755 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -709,7 +709,7 @@ static int s5p_mfc_open(struct file *file) ret = -ENOMEM; goto err_alloc; } - v4l2_fh_init(ctx-fh, video_devdata(file)); + v4l2_fh_init(ctx-fh, vdev); file-private_data = ctx-fh; v4l2_fh_add(ctx-fh); ctx-dev = dev; -- 1.7.9.5 -- 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: [PATCH 3/4] drm: exynos: add compatibles for HDMI and Mixer chips and exynos4210 SoC
Hi Tomasz, On 04/15/2014 12:00 AM, Tomasz Stanislawski wrote: This patch add proper compatibles for Mixer and HDMI chip available on exynos4210 SoCs. Signed-off-by: Tomasz Stanislawski t.stanisl...@samsung.com --- drivers/gpu/drm/exynos/exynos_hdmi.c |3 +++ drivers/gpu/drm/exynos/exynos_mixer.c |3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index d2d6e2e..6fa63ea 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -2032,6 +2032,9 @@ static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata static struct of_device_id hdmi_match_types[] = { { + .compatible = samsung,exynos4210-hdmi, + .data = (void *)HDMI_TYPE13, It's consistent with others to use struct hdmi_driver_data like exynos5_hdmi_driver_data. + }, { .compatible = samsung,exynos5-hdmi, .data = exynos5_hdmi_driver_data, }, { diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index e3306c8..fd8a9a0 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1187,6 +1187,9 @@ static struct platform_device_id mixer_driver_types[] = { static struct of_device_id mixer_match_types[] = { { + .compatible = samsung,exynos4210-mixer, + .data = exynos4210_mxr_drv_data, + }, { .compatible = samsung,exynos5-mixer, .data = exynos5250_mxr_drv_data, }, { -- 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] s5p-mfc: Replaced commas with semicolons.
There is any reason to use comma here. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index e2aac59..90f4f69 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1147,9 +1147,9 @@ static int s5p_mfc_probe(struct platform_device *pdev) ret = -ENOMEM; goto err_dec_alloc; } - vfd-fops = s5p_mfc_fops, + vfd-fops = s5p_mfc_fops; vfd-ioctl_ops = get_dec_v4l2_ioctl_ops(); - vfd-release= video_device_release, + vfd-release= video_device_release; vfd-lock = dev-mfc_mutex; vfd-v4l2_dev = dev-v4l2_dev; vfd-vfl_dir= VFL_DIR_M2M; @@ -1172,9 +1172,9 @@ static int s5p_mfc_probe(struct platform_device *pdev) ret = -ENOMEM; goto err_enc_alloc; } - vfd-fops = s5p_mfc_fops, + vfd-fops = s5p_mfc_fops; vfd-ioctl_ops = get_enc_v4l2_ioctl_ops(); - vfd-release= video_device_release, + vfd-release= video_device_release; vfd-lock = dev-mfc_mutex; vfd-v4l2_dev = dev-v4l2_dev; vfd-vfl_dir= VFL_DIR_M2M; -- 1.8.1.2 -- 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] s5p-mfc: Replaced commas with semicolons.
There is no any reason to use comma here. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index e2aac59..90f4f69 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1147,9 +1147,9 @@ static int s5p_mfc_probe(struct platform_device *pdev) ret = -ENOMEM; goto err_dec_alloc; } - vfd-fops = s5p_mfc_fops, + vfd-fops = s5p_mfc_fops; vfd-ioctl_ops = get_dec_v4l2_ioctl_ops(); - vfd-release= video_device_release, + vfd-release= video_device_release; vfd-lock = dev-mfc_mutex; vfd-v4l2_dev = dev-v4l2_dev; vfd-vfl_dir= VFL_DIR_M2M; @@ -1172,9 +1172,9 @@ static int s5p_mfc_probe(struct platform_device *pdev) ret = -ENOMEM; goto err_enc_alloc; } - vfd-fops = s5p_mfc_fops, + vfd-fops = s5p_mfc_fops; vfd-ioctl_ops = get_enc_v4l2_ioctl_ops(); - vfd-release= video_device_release, + vfd-release= video_device_release; vfd-lock = dev-mfc_mutex; vfd-v4l2_dev = dev-v4l2_dev; vfd-vfl_dir= VFL_DIR_M2M; -- 1.8.1.2 -- 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 07/24] xc5000: properly report i2c write failures
Hi Devin, 2014-02-07 22:46 GMT+09:00 Devin Heitmueller dheitmuel...@kernellabs.com: I can't load firmware like error of below link. https://bugs.launchpad.net/ubuntu/+source/linux-firmware-nonfree/+bug/1263837 This error is related with this patch. This fix is right but above error is created after this fix because my device makes WatchDogTimer to 0 when load firmware. Maybe it will be related with XREG_BUSY register but i can't check it. I removed this fix, but i have faced at other error with xc5000: PLL not running after fwload So i have commented like below. static const struct xc5000_fw_cfg xc5000a_1_6_114 = { .name = XC5000A_FIRMWARE, .size = 12401, //.pll_reg = 0x806c, }; Then, xc5000 device works well. I don't have xc5000 datasheet so i can't debug xc5000 driver anymore. Hi Joonyoung, Assuming this is the DViCO FusionHDTV7 device that uses the au0828/au8522, I suspect that what's happening here is your I2C controller is not stable. The I2C clock stretching done by the xc5000 often exposed bugs in various bridge drivers and the au0828 was no exception. I had to work around these hardware bugs in the au0828 driver but I made them specific to the HVR-950q since that was the only device I could test with. In other words, the xc5000 is most likely doing exactly what it is supposed to, and the increased robustness of the tuner driver with those two patches exposed intermittent I2C failures in au0828 that were previously being silently discarded (resulting in indeterminate behavior). I would recommending looking at the changes in au0828-cards.c for the HVR-950q and add the code necessary to make them also apply for the DVICO device, and that should resolve your problems (in particular the i2c_clk_divider field should be set). As you said, i modified like below patch and it is working well. Thanks for your advice. diff --git a/drivers/media/usb/au0828/au0828-cards.c b/drivers/media/usb/au0828/au0828-cards.c index 0cb7c28..9936875 100644 --- a/drivers/media/usb/au0828/au0828-cards.c +++ b/drivers/media/usb/au0828/au0828-cards.c @@ -108,7 +108,7 @@ struct au0828_board au0828_boards[] = { .name= DViCO FusionHDTV USB, .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, -.i2c_clk_divider = AU0828_I2C_CLK_250KHZ, +.i2c_clk_divider = AU0828_I2C_CLK_20KHZ, }, [AU0828_BOARD_HAUPPAUGE_WOODBURY] = { .name = Hauppauge Woodbury, - Joonyoung Shim -- 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] au0828: fix i2c clock speed for DViCO FusionHDTV7
DViCO FusionHDTV7 device that use au0828 can fail to communicate with xc5000 using i2c interface because of high i2c clock speed - i2c clock stretching bug. It causes to fail xc5000 firmware loading normally at the current driver. Already this problem fixed as changing to low i2c clock speed at HVR-950q device, also DViCO FusionHDTV7 device can solve it as using low i2c clock speed - 20KHz. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/usb/au0828/au0828-cards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/au0828/au0828-cards.c b/drivers/media/usb/au0828/au0828-cards.c index dd32dec..6b569f4 100644 --- a/drivers/media/usb/au0828/au0828-cards.c +++ b/drivers/media/usb/au0828/au0828-cards.c @@ -108,7 +108,7 @@ struct au0828_board au0828_boards[] = { .name = DViCO FusionHDTV USB, .tuner_type = UNSET, .tuner_addr = ADDR_UNSET, - .i2c_clk_divider = AU0828_I2C_CLK_250KHZ, + .i2c_clk_divider = AU0828_I2C_CLK_20KHZ, }, [AU0828_BOARD_HAUPPAUGE_WOODBURY] = { .name = Hauppauge Woodbury, -- 1.8.1.2 -- 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 07/24] xc5000: properly report i2c write failures
Hi, Sorry for response about the past post. The logic as written would *never* actually return an error condition, since the loop would run until the counter hit zero but the check was for a value less than zero. Signed-off-by: Devin Heitmueller dheitmuel...@kernellabs.com --- drivers/media/common/tuners/xc5000.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index f660e33..a7fa17e 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c @@ -341,7 +341,7 @@static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData) } } } - if (WatchDogTimer 0) + if (WatchDogTimer = 0) I can't load firmware like error of below link. https://bugs.launchpad.net/ubuntu/+source/linux-firmware-nonfree/+bug/1263837 https://bugs.launchpad.net/ubuntu/+source/linux-firmware-nonfree/+bug/1263837 This error is related with this patch. This fix is right but above error is created after this fix because my device makes WatchDogTimer to 0 when load firmware. Maybe it will be related with XREG_BUSY register but i can't check it. I removed this fix, but i have faced at other error with xc5000: PLL not running after fwload So i have commented like below. static const struct xc5000_fw_cfg xc5000a_1_6_114 = { .name = XC5000A_FIRMWARE, .size = 12401, //.pll_reg = 0x806c, }; Then, xc5000 device works well. I don't have xc5000 datasheet so i can't debug xc5000 driver anymore. Any help? Thanks. result = XC_RESULT_I2C_WRITE_FAILURE; return result; -- 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 v6 1/1] video: drm: exynos: Add display-timing node parsing using video helper function
Hi, On 02/21/2013 04:18 PM, Joonyoung Shim wrote: On 02/21/2013 04:12 PM, Vikas Sajjan wrote: Hi, On 21 February 2013 12:25, Joonyoung Shim jy0922.s...@samsung.com wrote: Hi, On 02/15/2013 03:43 PM, Vikas Sajjan wrote: Add support for parsing the display-timing node using video helper function. The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part. Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 37 ++ 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9537761..8b2c0ff 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -19,7 +19,9 @@ #include linux/clk.h #include linux/of_device.h #include linux/pm_runtime.h +#include linux/pinctrl/consumer.h +#include video/of_display_timing.h #include video/samsung_fimd.h #include drm/exynos_drm.h @@ -877,16 +879,43 @@ static int fimd_probe(struct platform_device *pdev) struct exynos_drm_subdrv *subdrv; struct exynos_drm_fimd_pdata *pdata; struct exynos_drm_panel_info *panel; + struct fb_videomode *fbmode; + struct pinctrl *pctrl; struct resource *res; int win; int ret = -EINVAL; DRM_DEBUG_KMS(%s\n, __FILE__); - pdata = pdev-dev.platform_data; - if (!pdata) { - dev_err(dev, no platform data specified\n); - return -EINVAL; + if (pdev-dev.of_node) { + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + DRM_ERROR(memory allocation for pdata failed\n); + return -ENOMEM; + } + + fbmode = pdata-panel.timing; + ret = of_get_fb_videomode(dev-of_node, fbmode, + OF_USE_NATIVE_MODE); fbmode variable can be substituted to pdata-panel.timing directly then can remove fbmode variable. this is can be done. + if (ret) { + DRM_ERROR(failed: of_get_fb_videomode()\n + with return value: %d\n, ret); + return ret; + } + + pctrl = devm_pinctrl_get_select_default(dev); + if (IS_ERR_OR_NULL(pctrl)) { It's enough to if (IS_ERR(pctrl)) {. what if it returns NULL? devm_pinctrl_get_select_default() never return NULL. My mistake. If CONFIG_PINCTRL is disabled, devm_pinctrl_get_select_default can return NULL. Linus, devm_pinctrl_get_select() and pinctrl_get_select() also need IS_ERR_OR_NULL instead of IS_ERR? And many drivers using above functions don't check NULL, right? Thanks. + DRM_ERROR(failed: devm_pinctrl_get_select_default()\n + with return value: %d\n, PTR_RET(pctrl)); + return PTR_RET(pctrl); It's enough to return PTR_ERR(pctrl); ok. + } If this needs, parts for pinctrl should go to another patch. I have it as a separate patch already. [PATCH v7 2/2] video: drm: exynos: Add pinctrl support to fimd + + } else { + pdata = pdev-dev.platform_data; + if (!pdata) { + DRM_ERROR(no platform data specified\n); + return -EINVAL; + } } panel = pdata-panel; Thanks. ___ dri-devel mailing list dri-de...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel -- 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 v8 1/2] video: drm: exynos: Add display-timing node parsing using video helper function
On 02/27/2013 08:49 PM, Vikas Sajjan wrote: Add support for parsing the display-timing node using video helper function. The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part. Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9537761..7932dc2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -20,6 +20,7 @@ #include linux/of_device.h #include linux/pm_runtime.h +#include video/of_display_timing.h #include video/samsung_fimd.h #include drm/exynos_drm.h @@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device *pdev) DRM_DEBUG_KMS(%s\n, __FILE__); - pdata = pdev-dev.platform_data; - if (!pdata) { - dev_err(dev, no platform data specified\n); - return -EINVAL; + if (pdev-dev.of_node) { + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + DRM_ERROR(memory allocation for pdata failed\n); + return -ENOMEM; + } + + ret = of_get_fb_videomode(dev-of_node, pdata-panel.timing, + OF_USE_NATIVE_MODE); + if (ret) { + DRM_ERROR(failed: of_get_fb_videomode()\n + with return value: %d\n, ret); Could you make this error log to one line? except this, Acked-by: Joonyoung Shim jy0922.s...@samsung.com + return ret; + } + } else { + pdata = pdev-dev.platform_data; + if (!pdata) { + DRM_ERROR(no platform data specified\n); + return -EINVAL; + } } panel = pdata-panel; -- 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] drm/exynos: modify the compatible string for exynos fimd
On 02/27/2013 07:32 PM, Vikas Sajjan wrote: modified compatible string for exynos4 fimd as exynos4210-fimd and exynos5 fimd as exynos5250-fimd to stick to the rule that compatible value should be named after first specific SoC model in which this particular IP version was included as discussed at https://patchwork.kernel.org/patch/2144861/ Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org --- drivers/gpu/drm/exynos/exynos_drm_fimd.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9537761..433ed35 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -109,9 +109,9 @@ struct fimd_context { #ifdef CONFIG_OF static const struct of_device_id fimd_driver_dt_match[] = { - { .compatible = samsung,exynos4-fimd, + { .compatible = samsung,exynos4210-fimd, .data = exynos4_fimd_driver_data }, - { .compatible = samsung,exynos5-fimd, + { .compatible = samsung,exynos5250-fimd, .data = exynos5_fimd_driver_data }, {}, }; Acked-by: Joonyoung Shim jy0922.s...@samsung.com Thanks. -- 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 v8 1/2] video: drm: exynos: Add display-timing node parsing using video helper function
On 02/28/2013 11:45 AM, Vikas Sajjan wrote: Hi, On 28 February 2013 08:07, Joonyoung Shim jy0922.s...@samsung.com wrote: On 02/27/2013 08:49 PM, Vikas Sajjan wrote: Add support for parsing the display-timing node using video helper function. The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part. Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9537761..7932dc2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -20,6 +20,7 @@ #include linux/of_device.h #include linux/pm_runtime.h +#include video/of_display_timing.h #include video/samsung_fimd.h #include drm/exynos_drm.h @@ -883,10 +884,26 @@ static int fimd_probe(struct platform_device *pdev) DRM_DEBUG_KMS(%s\n, __FILE__); - pdata = pdev-dev.platform_data; - if (!pdata) { - dev_err(dev, no platform data specified\n); - return -EINVAL; + if (pdev-dev.of_node) { + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + DRM_ERROR(memory allocation for pdata failed\n); + return -ENOMEM; + } + + ret = of_get_fb_videomode(dev-of_node, pdata-panel.timing, + OF_USE_NATIVE_MODE); + if (ret) { + DRM_ERROR(failed: of_get_fb_videomode()\n + with return value: %d\n, ret); Could you make this error log to one line? The Line was going beyond 80 line marks, hence I had to split it. So remove or contract some log messages, e.g. with return value I think that is unnecessary. except this, Acked-by: Joonyoung Shim jy0922.s...@samsung.com + return ret; + } + } else { + pdata = pdev-dev.platform_data; + if (!pdata) { + DRM_ERROR(no platform data specified\n); + return -EINVAL; + } } panel = pdata-panel; -- 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 v6 1/1] video: drm: exynos: Add display-timing node parsing using video helper function
Hi, On 02/15/2013 03:43 PM, Vikas Sajjan wrote: Add support for parsing the display-timing node using video helper function. The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part. Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 37 ++ 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9537761..8b2c0ff 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -19,7 +19,9 @@ #include linux/clk.h #include linux/of_device.h #include linux/pm_runtime.h +#include linux/pinctrl/consumer.h +#include video/of_display_timing.h #include video/samsung_fimd.h #include drm/exynos_drm.h @@ -877,16 +879,43 @@ static int fimd_probe(struct platform_device *pdev) struct exynos_drm_subdrv *subdrv; struct exynos_drm_fimd_pdata *pdata; struct exynos_drm_panel_info *panel; + struct fb_videomode *fbmode; + struct pinctrl *pctrl; struct resource *res; int win; int ret = -EINVAL; DRM_DEBUG_KMS(%s\n, __FILE__); - pdata = pdev-dev.platform_data; - if (!pdata) { - dev_err(dev, no platform data specified\n); - return -EINVAL; + if (pdev-dev.of_node) { + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + DRM_ERROR(memory allocation for pdata failed\n); + return -ENOMEM; + } + + fbmode = pdata-panel.timing; + ret = of_get_fb_videomode(dev-of_node, fbmode, + OF_USE_NATIVE_MODE); fbmode variable can be substituted to pdata-panel.timing directly then can remove fbmode variable. + if (ret) { + DRM_ERROR(failed: of_get_fb_videomode()\n + with return value: %d\n, ret); + return ret; + } + + pctrl = devm_pinctrl_get_select_default(dev); + if (IS_ERR_OR_NULL(pctrl)) { It's enough to if (IS_ERR(pctrl)) {. + DRM_ERROR(failed: devm_pinctrl_get_select_default()\n + with return value: %d\n, PTR_RET(pctrl)); + return PTR_RET(pctrl); It's enough to return PTR_ERR(pctrl); + } If this needs, parts for pinctrl should go to another patch. + + } else { + pdata = pdev-dev.platform_data; + if (!pdata) { + DRM_ERROR(no platform data specified\n); + return -EINVAL; + } } panel = pdata-panel; Thanks. -- 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 v7 0/2] Add display-timing node parsing to exynos drm fimd
Hi, Please refer my comments about v6 patch. On 02/21/2013 02:11 PM, Vikas Sajjan wrote: Add display-timing node parsing to drm fimd and depends on the display helper patchset at http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html It also adds pinctrl support for drm fimd. changes since v6: addressed comments from Inki Dae inki@samsung.com to separated out the pinctrl functionality and made a separate patch. changes since v5: - addressed comments from Inki Dae inki@samsung.com, to remove the allocation of 'fbmode' and replaced '-1'in of_get_fb_videomode(dev-of_node, fbmode, -1) with OF_USE_NATIVE_MODE. changes since v4: - addressed comments from Paul Menzel paulepan...@users.sourceforge.net, to modify the commit message changes since v3: - addressed comments from Sean Paul seanp...@chromium.org, to modify the return values and print messages. changes since v2: - moved 'devm_pinctrl_get_select_default' function call under 'if (pdev-dev.of_node)', this makes NON-DT code unchanged. (reported by: Rahul Sharma r.sh.o...@gmail.com) changes since v1: - addressed comments from Sean Paul seanp...@chromium.org Vikas Sajjan (2): video: drm: exynos: Add display-timing node parsing using video helper function video: drm: exynos: Add pinctrl support to fimd drivers/gpu/drm/exynos/exynos_drm_fimd.c | 36 ++ 1 file changed, 32 insertions(+), 4 deletions(-) -- 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 v7 2/2] video: drm: exynos: Add pinctrl support to fimd
Hi, On 02/21/2013 02:11 PM, Vikas Sajjan wrote: Adds support for pinctrl to drm fimd. Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org --- drivers/gpu/drm/exynos/exynos_drm_fimd.c |9 + 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index f80cf68..878b134 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -19,6 +19,7 @@ #include linux/clk.h #include linux/of_device.h #include linux/pm_runtime.h +#include linux/pinctrl/consumer.h #include video/of_display_timing.h #include video/samsung_fimd.h @@ -879,6 +880,7 @@ static int fimd_probe(struct platform_device *pdev) struct exynos_drm_fimd_pdata *pdata; struct exynos_drm_panel_info *panel; struct fb_videomode *fbmode; + struct pinctrl *pctrl; struct resource *res; int win; int ret = -EINVAL; @@ -900,6 +902,13 @@ static int fimd_probe(struct platform_device *pdev) with return value: %d\n, ret); return ret; } + pctrl = devm_pinctrl_get_select_default(dev); + if (IS_ERR_OR_NULL(pctrl)) { + DRM_ERROR(failed: devm_pinctrl_get_select_default()\n + with return value: %d\n, PTR_RET(pctrl)); + return PTR_RET(pctrl); + } I think pinctrl isn't related with dt then it doesn't need to be in if (pdev-dev.of_node). + Blank. } else { pdata = pdev-dev.platform_data; if (!pdata) { -- 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 v6 1/1] video: drm: exynos: Add display-timing node parsing using video helper function
On 02/21/2013 04:12 PM, Vikas Sajjan wrote: Hi, On 21 February 2013 12:25, Joonyoung Shim jy0922.s...@samsung.com wrote: Hi, On 02/15/2013 03:43 PM, Vikas Sajjan wrote: Add support for parsing the display-timing node using video helper function. The DT node parsing and pinctrl selection is done only if 'dev.of_node' exists and the NON-DT logic is still maintained under the 'else' part. Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 37 ++ 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9537761..8b2c0ff 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -19,7 +19,9 @@ #include linux/clk.h #include linux/of_device.h #include linux/pm_runtime.h +#include linux/pinctrl/consumer.h +#include video/of_display_timing.h #include video/samsung_fimd.h #include drm/exynos_drm.h @@ -877,16 +879,43 @@ static int fimd_probe(struct platform_device *pdev) struct exynos_drm_subdrv *subdrv; struct exynos_drm_fimd_pdata *pdata; struct exynos_drm_panel_info *panel; + struct fb_videomode *fbmode; + struct pinctrl *pctrl; struct resource *res; int win; int ret = -EINVAL; DRM_DEBUG_KMS(%s\n, __FILE__); - pdata = pdev-dev.platform_data; - if (!pdata) { - dev_err(dev, no platform data specified\n); - return -EINVAL; + if (pdev-dev.of_node) { + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + DRM_ERROR(memory allocation for pdata failed\n); + return -ENOMEM; + } + + fbmode = pdata-panel.timing; + ret = of_get_fb_videomode(dev-of_node, fbmode, + OF_USE_NATIVE_MODE); fbmode variable can be substituted to pdata-panel.timing directly then can remove fbmode variable. this is can be done. + if (ret) { + DRM_ERROR(failed: of_get_fb_videomode()\n + with return value: %d\n, ret); + return ret; + } + + pctrl = devm_pinctrl_get_select_default(dev); + if (IS_ERR_OR_NULL(pctrl)) { It's enough to if (IS_ERR(pctrl)) {. what if it returns NULL? devm_pinctrl_get_select_default() never return NULL. + DRM_ERROR(failed: devm_pinctrl_get_select_default()\n + with return value: %d\n, PTR_RET(pctrl)); + return PTR_RET(pctrl); It's enough to return PTR_ERR(pctrl); ok. + } If this needs, parts for pinctrl should go to another patch. I have it as a separate patch already. [PATCH v7 2/2] video: drm: exynos: Add pinctrl support to fimd + + } else { + pdata = pdev-dev.platform_data; + if (!pdata) { + DRM_ERROR(no platform data specified\n); + return -EINVAL; + } } panel = pdata-panel; Thanks. -- 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 2/2] drm/exynos: Add device tree based discovery support for G2D
On 02/05/2013 12:03 PM, Inki Dae wrote: 2013/2/4 Sachin Kamat sachin.ka...@linaro.org: On 1 February 2013 18:28, Inki Dae daei...@gmail.com wrote: 2013. 2. 1. 오후 8:52 Inki Dae inki@samsung.com 작성: -Original Message- From: linux-media-ow...@vger.kernel.org [mailto:linux-media- ow...@vger.kernel.org] On Behalf Of Sachin Kamat Sent: Friday, February 01, 2013 8:40 PM To: Inki Dae Cc: Sylwester Nawrocki; Kukjin Kim; Sylwester Nawrocki; linux- me...@vger.kernel.org; dri-de...@lists.freedesktop.org; devicetree- disc...@lists.ozlabs.org; patc...@linaro.org Subject: Re: [PATCH 2/2] drm/exynos: Add device tree based discovery support for G2D On 1 February 2013 17:02, Inki Dae inki@samsung.com wrote: How about using like below? Compatible = samsung,exynos4x12-fimg-2d /* for Exynos4212, Exynos4412 */ It looks odd to use samsung,exynos4212-fimg-2d saying that this ip is for exynos4212 and exynos4412. AFAIK, compatible strings are not supposed to have any wildcard characters. Compatible string should suggest the first SoC that contained this IP. Hence IMO 4212 is OK. Oops, one more thing. AFAIK Exynos4210 also has fimg-2d ip. In this case, we should use samsung,exynos4210-fimg-2d as comparible string and add it to exynos4210.dtsi? Exynos4210 has same g2d IP (v3.0) as C110 or V210; so the same comptible string will be used for this one too. And please check if exynos4212 and 4412 SoCs have same fimg-2d ip. If it's different, we might need to add ip version property or compatible string to each dtsi file to identify the ip version. AFAIK, they both have the same IP (v4.1). Ok, let's use the below, For exynos4210 SoC, compatible = samsung,exynos4210-g2d For exynos4x12 SoCs, compatible = samsung,exynos4212-g2d For exynos5250, 5410 (In case of Exynos5440, I'm not sure that the SoC has same ip) compatible = samsung,exynos5250-g2d To other guys, The device tree is used by not only v4l2 side but also drm side so we should reach an arrangement. So please give me ack if you agree to my opinion. Otherwise please, give me your opinions. I like this compatible, also we can use rule like this to HDMI of drm/exynos. Thanks, Inki Dae Sorry but give me your opinions. Thanks, Inki Dae Got it. Please post it again. -- With warm regards, Sachin -- 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 ___ dri-devel mailing list dri-de...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel -- With warm regards, Sachin ___ dri-devel mailing list dri-de...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel -- 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 2/4] [Media] Create new control class for FM RX.
On 04/18/2012 07:17 AM, manjunatha_ha...@ti.com wrote: From: Manjunatha Hallix0130...@ti.com Also this patch adds CID's for below new FM features, 1) FM RX - De-Emphasis filter mode and RDS AF switch 2) FM TX - RDS Alternate frequency set. The subject of this patch is about FM RX, but it includes also adding CID for FM TX. Can you split this patch? Signed-off-by: Manjunatha Hallix0130...@ti.com --- drivers/media/video/v4l2-ctrls.c | 18 ++ include/linux/videodev2.h| 17 - 2 files changed, 34 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 18015c0..b4ddd6b 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -372,6 +372,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id) NULL, }; + static const char * const tune_deemphasis[] = { + No deemphasis, + 50 useconds, + 75 useconds, + NULL, + }; switch (id) { case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: return mpeg_audio_sampling_freq; @@ -414,6 +420,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return colorfx; case V4L2_CID_TUNE_PREEMPHASIS: return tune_preemphasis; + case V4L2_CID_TUNE_DEEMPHASIS: + return tune_deemphasis; case V4L2_CID_FLASH_LED_MODE: return flash_led_mode; case V4L2_CID_FLASH_STROBE_SOURCE: @@ -606,6 +614,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_RDS_TX_PTY: return RDS Program Type; case V4L2_CID_RDS_TX_PS_NAME: return RDS PS Name; case V4L2_CID_RDS_TX_RADIO_TEXT:return RDS Radio Text; + case V4L2_CID_RDS_TX_AF_FREQ: return RDS Alternate Frequency; case V4L2_CID_AUDIO_LIMITER_ENABLED:return Audio Limiter Feature Enabled; case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return Audio Limiter Release Time; case V4L2_CID_AUDIO_LIMITER_DEVIATION: return Audio Limiter Deviation; @@ -644,6 +653,12 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_JPEG_COMPRESSION_QUALITY: return Compression Quality; case V4L2_CID_JPEG_ACTIVE_MARKER: return Active Markers; + /* FM Radio Receiver control */ + /* Keep the order of the 'case's the same as in videodev2.h! */ + case V4L2_CID_FM_RX_CLASS: return FM Radio Receiver Controls; + case V4L2_CID_RDS_AF_SWITCH:return FM RX RDS AF switch; + case V4L2_CID_TUNE_DEEMPHASIS: return FM RX De-emphasis settings; + default: return NULL; } @@ -688,6 +703,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM: case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE: case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL: + case V4L2_CID_RDS_AF_SWITCH: *type = V4L2_CTRL_TYPE_BOOLEAN; *min = 0; *max = *step = 1; @@ -733,6 +749,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: + case V4L2_CID_TUNE_DEEMPHASIS: *type = V4L2_CTRL_TYPE_MENU; break; case V4L2_CID_RDS_TX_PS_NAME: @@ -745,6 +762,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_FM_TX_CLASS: case V4L2_CID_FLASH_CLASS: case V4L2_CID_JPEG_CLASS: + case V4L2_CID_FM_RX_CLASS: *type = V4L2_CTRL_TYPE_CTRL_CLASS; /* You can neither read not write these */ *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index c9c9a46..d1c8c1b 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1137,6 +1137,7 @@ struct v4l2_ext_controls { #define V4L2_CTRL_CLASS_FM_TX 0x009b /* FM Modulator control class */ #define V4L2_CTRL_CLASS_FLASH 0x009c /* Camera flash controls */ #define V4L2_CTRL_CLASS_JPEG 0x009d /* JPEG-compression controls */ +#define V4L2_CTRL_CLASS_FM_RX 0x009e /* FM Receiver control class */ #define V4L2_CTRL_ID_MASK (0x0fff) #define V4L2_CTRL_ID2CLASS(id)((id) 0x0fffUL) @@ -1698,6 +1699,7 @@ enum v4l2_exposure_auto_type { #define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) #define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) #define V4L2_CID_RDS_TX_RADIO_TEXT(V4L2_CID_FM_TX_CLASS_BASE + 6) +#define V4L2_CID_RDS_TX_AF_FREQ
Re: [PATCH 8/8] v4l: radio: si470x: fix unneeded free_irq() call
On 2010-09-06 오후 3:53, Marek Szyprowski wrote: In case of error during probe() the driver calls free_irq() function on not yet allocated irq. This patches fixes the call sequence in case of the error. I sent this fix patch but it didn't go to linux-media ML by certain reason. Anyway this is good catch. Acked-by: Joonyoung Shim jy0922.s...@samsung.com Signed-off-by: Marek Szyprowskim.szyprow...@samsung.com Signed-off-by: Kyungmin Parkkyungmin.p...@samsung.com CC: Tobias Lorenztobias.lor...@gmx.net CC: Joonyoung Shimjy0922.s...@samsung.com CC: Douglas Schilling Landgrafdougsl...@redhat.com CC: Jean Delvarekh...@linux-fr.org --- drivers/media/radio/si470x/radio-si470x-i2c.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 67a4ec8..4ce541a 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -395,7 +395,7 @@ static int __devinit si470x_i2c_probe(struct i2c_client *client, radio-registers[POWERCFG] = POWERCFG_ENABLE; if (si470x_set_register(radio, POWERCFG) 0) { retval = -EIO; - goto err_all; + goto err_video; } msleep(110); -- 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/3] radio-si470x: Fix setting of de-emphasis
The de-emphasis should be setted if requested by module parameter instead of always setting de-emphasis. Reported-by: Tobias Lorenz tobias.lor...@gmx.net Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/radio/si470x/radio-si470x-common.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index 9927a59..7585566 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -357,7 +357,7 @@ int si470x_start(struct si470x_device *radio) goto done; /* sysconfig 1 */ - radio-registers[SYSCONFIG1] = SYSCONFIG1_DE; + radio-registers[SYSCONFIG1] = (de 11) SYSCONFIG1_DE; /* DE */ retval = si470x_set_register(radio, SYSCONFIG1); if (retval 0) goto done; -- 1.7.0.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 2/3] radio-si470x: Remove ifdef for RDS
The si470x i2c and usb driver support the RDS, so this ifdef statement doesn't need more. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/radio/si470x/radio-si470x-common.c |6 -- 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index 7585566..5c80df8 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -679,12 +679,8 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, /* driver constants */ strcpy(tuner-name, FM); tuner-type = V4L2_TUNER_RADIO; -#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) tuner-capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS; -#else - tuner-capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; -#endif /* range limits */ switch ((radio-registers[SYSCONFIG2] SYSCONFIG2_BAND) 6) { @@ -710,12 +706,10 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, tuner-rxsubchans = V4L2_TUNER_SUB_MONO; else tuner-rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; -#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) /* If there is a reliable method of detecting an RDS channel, then this code should check for that before setting this RDS subchannel. */ tuner-rxsubchans |= V4L2_TUNER_SUB_RDS; -#endif /* mono/stereo selector */ if ((radio-registers[POWERCFG] POWERCFG_MONO) == 0) -- 1.7.0.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 0/3] Fix bug of radio-si470x
This patch set is to fix bug of si470x common part and i2c driver. Thanks. Joonyoung Shim (3): radio-si470x: Fix setting of de-emphasis radio-si470x: Remove ifdef for RDS radio-si470x: Fix error handling of si470x i2c driver drivers/media/radio/si470x/radio-si470x-common.c |8 +--- drivers/media/radio/si470x/radio-si470x-i2c.c|2 +- 2 files changed, 2 insertions(+), 8 deletions(-) -- 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 3/3] radio-si470x: Fix error handling of si470x i2c driver
We should go to err_video instead of err_all if this error is occured when probed. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/radio/si470x/radio-si470x-i2c.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 67a4ec8..4ce541a 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -395,7 +395,7 @@ static int __devinit si470x_i2c_probe(struct i2c_client *client, radio-registers[POWERCFG] = POWERCFG_ENABLE; if (si470x_set_register(radio, POWERCFG) 0) { retval = -EIO; - goto err_all; + goto err_video; } msleep(110); -- 1.7.0.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
Question about the signal of struct v4l2_tuner to set value
Hi, all. I wonder about the usage of the signal variable of struct v4l2_tuner. I have found only to use it to get the signal strength on drivers. The si470x radio device can set the seek threshold value of RSSI(Received Signal Strength Indicator) when the device scans the channels, so if the current RSSI value is low than the seek threshold value, the device decides the frequency is nonvalidate channel. So, i need v4l2 interface to set the best seek threshold value and i want to use the signal of struct v4l2_tuner for it. Can the signal variable be used to set the value? -- 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
Radio application using V4L2 on console?
Hi, all. I just wonder there is any radio application using the V4L2 on console. I found only the Kradio app of KDE, but the KDE is difficult to use the embedded system. I am testing using my simple radio test application on console, but it is also difficult to test correctly RDS - parsing problem etc... Please introduce to me the radio application satisfied above requests if it exists. Thanks. -- 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 v2 0/3] patches for radio-si470x-i2c driver
Hi, I post patches v2 for radio-si470x-i2c driver. [PATCH v2 1/3] radio-si470x: move some file operations to common file [PATCH v2 2/3] radio-si470x: support RDS on si470x i2c driver [PATCH v2 3/3] radio-si470x: support PM functions 1/3 patch is same with v1. 2/3 patch is updated the RDS interrupt enable code by review of Tobias. 3/3 patch is to support PM. And first patch of v1 is unnecessary by 2/3 patch of v2. Thanks. -- 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 v2 3/3] radio-si470x: support PM functions
This patch is to support PM of the si470x i2c driver. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/radio/si470x/radio-si470x-i2c.c | 40 + 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 77532e6..4c6e586 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -486,6 +486,44 @@ static __devexit int si470x_i2c_remove(struct i2c_client *client) } +#ifdef CONFIG_PM +/* + * si470x_i2c_suspend - suspend the device + */ +static int si470x_i2c_suspend(struct i2c_client *client, pm_message_t mesg) +{ + struct si470x_device *radio = i2c_get_clientdata(client); + + /* power down */ + radio-registers[POWERCFG] |= POWERCFG_DISABLE; + if (si470x_set_register(radio, POWERCFG) 0) + return -EIO; + + return 0; +} + + +/* + * si470x_i2c_resume - resume the device + */ +static int si470x_i2c_resume(struct i2c_client *client) +{ + struct si470x_device *radio = i2c_get_clientdata(client); + + /* power up : need 110ms */ + radio-registers[POWERCFG] |= POWERCFG_ENABLE; + if (si470x_set_register(radio, POWERCFG) 0) + return -EIO; + msleep(110); + + return 0; +} +#else +#define si470x_i2c_suspend NULL +#define si470x_i2c_resume NULL +#endif + + /* * si470x_i2c_driver - i2c driver interface */ @@ -496,6 +534,8 @@ static struct i2c_driver si470x_i2c_driver = { }, .probe = si470x_i2c_probe, .remove = __devexit_p(si470x_i2c_remove), + .suspend= si470x_i2c_suspend, + .resume = si470x_i2c_resume, .id_table = si470x_i2c_id, }; -- 1.6.3.3 -- 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 v2 1/3] radio-si470x: move some file operations to common file
The read and poll file operations of the si470x usb driver can be used also equally on the si470x i2c driver, so they go to the common file. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/radio/si470x/radio-si470x-common.c | 98 ++ drivers/media/radio/si470x/radio-si470x-i2c.c| 15 +--- drivers/media/radio/si470x/radio-si470x-usb.c| 97 +- drivers/media/radio/si470x/radio-si470x.h|3 +- 4 files changed, 104 insertions(+), 109 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index 7296cf4..f4645d4 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -426,6 +426,104 @@ int si470x_rds_on(struct si470x_device *radio) /** + * File Operations Interface + **/ + +/* + * si470x_fops_read - read RDS data + */ +static ssize_t si470x_fops_read(struct file *file, char __user *buf, + size_t count, loff_t *ppos) +{ + struct si470x_device *radio = video_drvdata(file); + int retval = 0; + unsigned int block_count = 0; + + /* switch on rds reception */ + if ((radio-registers[SYSCONFIG1] SYSCONFIG1_RDS) == 0) + si470x_rds_on(radio); + + /* block if no new data available */ + while (radio-wr_index == radio-rd_index) { + if (file-f_flags O_NONBLOCK) { + retval = -EWOULDBLOCK; + goto done; + } + if (wait_event_interruptible(radio-read_queue, + radio-wr_index != radio-rd_index) 0) { + retval = -EINTR; + goto done; + } + } + + /* calculate block count from byte count */ + count /= 3; + + /* copy RDS block out of internal buffer and to user buffer */ + mutex_lock(radio-lock); + while (block_count count) { + if (radio-rd_index == radio-wr_index) + break; + + /* always transfer rds complete blocks */ + if (copy_to_user(buf, radio-buffer[radio-rd_index], 3)) + /* retval = -EFAULT; */ + break; + + /* increment and wrap read pointer */ + radio-rd_index += 3; + if (radio-rd_index = radio-buf_size) + radio-rd_index = 0; + + /* increment counters */ + block_count++; + buf += 3; + retval += 3; + } + mutex_unlock(radio-lock); + +done: + return retval; +} + + +/* + * si470x_fops_poll - poll RDS data + */ +static unsigned int si470x_fops_poll(struct file *file, + struct poll_table_struct *pts) +{ + struct si470x_device *radio = video_drvdata(file); + int retval = 0; + + /* switch on rds reception */ + if ((radio-registers[SYSCONFIG1] SYSCONFIG1_RDS) == 0) + si470x_rds_on(radio); + + poll_wait(file, radio-read_queue, pts); + + if (radio-rd_index != radio-wr_index) + retval = POLLIN | POLLRDNORM; + + return retval; +} + + +/* + * si470x_fops - file operations interface + */ +static const struct v4l2_file_operations si470x_fops = { + .owner = THIS_MODULE, + .read = si470x_fops_read, + .poll = si470x_fops_poll, + .ioctl = video_ioctl2, + .open = si470x_fops_open, + .release= si470x_fops_release, +}; + + + +/** * Video4Linux Interface **/ diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 2d53b6a..4816a6d 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -173,7 +173,7 @@ int si470x_disconnect_check(struct si470x_device *radio) /* * si470x_fops_open - file open */ -static int si470x_fops_open(struct file *file) +int si470x_fops_open(struct file *file) { struct si470x_device *radio = video_drvdata(file); int retval = 0; @@ -194,7 +194,7 @@ static int si470x_fops_open(struct file *file) /* * si470x_fops_release - file release */ -static int si470x_fops_release(struct file *file) +int si470x_fops_release(struct file *file) { struct si470x_device *radio = video_drvdata(file); int retval = 0; @@ -215,17 +215,6 @@ static int si470x_fops_release(struct file *file) } -/* - * si470x_fops - file operations interface
Re: [PATCH 1/3] radio-si470x: fix SYSCONFIG1 register set on si470x_start()
Hi, Tobias. On 12/2/2009 8:39 AM, Tobias Lorenz wrote: Hi, what is the advantage in not setting SYSCONFIG1 into a known state? At patch 3/3, i am setting the SYSCONFIG1 register for RDS interrupt in i2c probe function, so i need this patch. Do you have other idea? Bye, Toby Am Mittwoch 18 November 2009 07:21:25 schrieb Joonyoung Shim: We should use the or operation to set value to the SYSCONFIG1 register on si470x_start(). Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/radio/si470x/radio-si470x-common.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index f33315f..09f631a 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -357,7 +357,7 @@ int si470x_start(struct si470x_device *radio) goto done; /* sysconfig 1 */ -radio-registers[SYSCONFIG1] = SYSCONFIG1_DE; +radio-registers[SYSCONFIG1] |= SYSCONFIG1_DE; retval = si470x_set_register(radio, SYSCONFIG1); if (retval 0) goto done; -- 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/3] radio-si470x: fix SYSCONFIG1 register set on si470x_start()
On 12/2/2009 9:12 AM, Tobias Lorenz wrote: Hi, ok, understood this problem. So, why not set this in si470x_fops_open directly after the si470x_start? It seems more appropriate to enable the RDS interrupt after starting the radio. OK, it makes sense. I will move it in si470x_fops_open. Bye the way, you pointed me to a bug. Instead of always setting de-emphasis in si470x_start: radio-registers[SYSCONFIG1] = SYSCONFIG1_DE; This should only be done, if requested by module parameter: radio-registers[SYSCONFIG1] = (de 11) SYSCONFIG1_DE; /* DE */ Ah, That's right. Thanks. -- 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 2/3] radio-si470x: move some file operations to common file
The read and poll file operations of the si470x usb driver can be used also equally on the si470x i2c driver, so they go to the common file. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/radio/si470x/radio-si470x-common.c | 98 ++ drivers/media/radio/si470x/radio-si470x-i2c.c| 15 +--- drivers/media/radio/si470x/radio-si470x-usb.c| 97 +- drivers/media/radio/si470x/radio-si470x.h|3 +- 4 files changed, 104 insertions(+), 109 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index 7296cf4..f4645d4 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -426,6 +426,104 @@ int si470x_rds_on(struct si470x_device *radio) /** + * File Operations Interface + **/ + +/* + * si470x_fops_read - read RDS data + */ +static ssize_t si470x_fops_read(struct file *file, char __user *buf, + size_t count, loff_t *ppos) +{ + struct si470x_device *radio = video_drvdata(file); + int retval = 0; + unsigned int block_count = 0; + + /* switch on rds reception */ + if ((radio-registers[SYSCONFIG1] SYSCONFIG1_RDS) == 0) + si470x_rds_on(radio); + + /* block if no new data available */ + while (radio-wr_index == radio-rd_index) { + if (file-f_flags O_NONBLOCK) { + retval = -EWOULDBLOCK; + goto done; + } + if (wait_event_interruptible(radio-read_queue, + radio-wr_index != radio-rd_index) 0) { + retval = -EINTR; + goto done; + } + } + + /* calculate block count from byte count */ + count /= 3; + + /* copy RDS block out of internal buffer and to user buffer */ + mutex_lock(radio-lock); + while (block_count count) { + if (radio-rd_index == radio-wr_index) + break; + + /* always transfer rds complete blocks */ + if (copy_to_user(buf, radio-buffer[radio-rd_index], 3)) + /* retval = -EFAULT; */ + break; + + /* increment and wrap read pointer */ + radio-rd_index += 3; + if (radio-rd_index = radio-buf_size) + radio-rd_index = 0; + + /* increment counters */ + block_count++; + buf += 3; + retval += 3; + } + mutex_unlock(radio-lock); + +done: + return retval; +} + + +/* + * si470x_fops_poll - poll RDS data + */ +static unsigned int si470x_fops_poll(struct file *file, + struct poll_table_struct *pts) +{ + struct si470x_device *radio = video_drvdata(file); + int retval = 0; + + /* switch on rds reception */ + if ((radio-registers[SYSCONFIG1] SYSCONFIG1_RDS) == 0) + si470x_rds_on(radio); + + poll_wait(file, radio-read_queue, pts); + + if (radio-rd_index != radio-wr_index) + retval = POLLIN | POLLRDNORM; + + return retval; +} + + +/* + * si470x_fops - file operations interface + */ +static const struct v4l2_file_operations si470x_fops = { + .owner = THIS_MODULE, + .read = si470x_fops_read, + .poll = si470x_fops_poll, + .ioctl = video_ioctl2, + .open = si470x_fops_open, + .release= si470x_fops_release, +}; + + + +/** * Video4Linux Interface **/ diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 2d53b6a..4816a6d 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -173,7 +173,7 @@ int si470x_disconnect_check(struct si470x_device *radio) /* * si470x_fops_open - file open */ -static int si470x_fops_open(struct file *file) +int si470x_fops_open(struct file *file) { struct si470x_device *radio = video_drvdata(file); int retval = 0; @@ -194,7 +194,7 @@ static int si470x_fops_open(struct file *file) /* * si470x_fops_release - file release */ -static int si470x_fops_release(struct file *file) +int si470x_fops_release(struct file *file) { struct si470x_device *radio = video_drvdata(file); int retval = 0; @@ -215,17 +215,6 @@ static int si470x_fops_release(struct file *file) } -/* - * si470x_fops - file operations interface
[PATCH 3/3] radio-si470x: support RDS on si470x i2c driver
This patch is to support RDS on si470x i2c driver. The routine of RDS operation is almost same with thing of usb driver, but this uses RDS interrupt. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- drivers/media/radio/si470x/radio-si470x-i2c.c | 159 +++-- drivers/media/radio/si470x/radio-si470x.h |1 + 2 files changed, 152 insertions(+), 8 deletions(-) diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 4816a6d..77532e6 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -22,22 +22,17 @@ */ -/* - * ToDo: - * - RDS support - */ - - /* driver definitions */ #define DRIVER_AUTHOR Joonyoung Shim jy0922.s...@samsung.com; -#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 0) +#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 1) #define DRIVER_CARD Silicon Labs Si470x FM Radio Receiver #define DRIVER_DESC I2C radio driver for Si470x FM Radio Receivers -#define DRIVER_VERSION 1.0.0 +#define DRIVER_VERSION 1.0.1 /* kernel includes */ #include linux/i2c.h #include linux/delay.h +#include linux/interrupt.h #include radio-si470x.h @@ -62,6 +57,20 @@ static int radio_nr = -1; module_param(radio_nr, int, 0444); MODULE_PARM_DESC(radio_nr, Radio Nr); +/* RDS buffer blocks */ +static unsigned int rds_buf = 100; +module_param(rds_buf, uint, 0444); +MODULE_PARM_DESC(rds_buf, RDS buffer entries: *100*); + +/* RDS maximum block errors */ +static unsigned short max_rds_errors = 1; +/* 0 means 0 errors requiring correction */ +/* 1 means 1-2 errors requiring correction (used by original USBRadio.exe) */ +/* 2 means 3-5 errors requiring correction */ +/* 3 means 6+ errors or errors in checkword, correction not possible */ +module_param(max_rds_errors, ushort, 0644); +MODULE_PARM_DESC(max_rds_errors, RDS maximum block errors: *1*); + /** @@ -242,6 +251,105 @@ int si470x_vidioc_querycap(struct file *file, void *priv, **/ /* + * si470x_i2c_interrupt_work - rds processing function + */ +static void si470x_i2c_interrupt_work(struct work_struct *work) +{ + struct si470x_device *radio = container_of(work, + struct si470x_device, radio_work); + unsigned char regnr; + unsigned char blocknum; + unsigned short bler; /* rds block errors */ + unsigned short rds; + unsigned char tmpbuf[3]; + int retval = 0; + + /* safety checks */ + if ((radio-registers[SYSCONFIG1] SYSCONFIG1_RDS) == 0) + return; + + /* Update RDS registers */ + for (regnr = 0; regnr RDS_REGISTER_NUM; regnr++) { + retval = si470x_get_register(radio, STATUSRSSI + regnr); + if (retval 0) + return; + } + + /* get rds blocks */ + if ((radio-registers[STATUSRSSI] STATUSRSSI_RDSR) == 0) + /* No RDS group ready, better luck next time */ + return; + + for (blocknum = 0; blocknum 4; blocknum++) { + switch (blocknum) { + default: + bler = (radio-registers[STATUSRSSI] + STATUSRSSI_BLERA) 9; + rds = radio-registers[RDSA]; + break; + case 1: + bler = (radio-registers[READCHAN] + READCHAN_BLERB) 14; + rds = radio-registers[RDSB]; + break; + case 2: + bler = (radio-registers[READCHAN] + READCHAN_BLERC) 12; + rds = radio-registers[RDSC]; + break; + case 3: + bler = (radio-registers[READCHAN] + READCHAN_BLERD) 10; + rds = radio-registers[RDSD]; + break; + }; + + /* Fill the V4L2 RDS buffer */ + put_unaligned_le16(rds, tmpbuf); + tmpbuf[2] = blocknum; /* offset name */ + tmpbuf[2] |= blocknum 3; /* received offset */ + if (bler max_rds_errors) + tmpbuf[2] |= 0x80; /* uncorrectable errors */ + else if (bler 0) + tmpbuf[2] |= 0x40; /* corrected error(s) */ + + /* copy RDS block to internal buffer */ + memcpy(radio-buffer[radio-wr_index], tmpbuf, 3); + radio-wr_index += 3; + + /* wrap write pointer */ + if (radio-wr_index = radio-buf_size) + radio-wr_index = 0; + + /* check for overflow
Re: [PATCH v2 0/4] radio-si470x: separate usb and i2c interface
Hi, On 7/30/2009 7:26 PM, Tobias Lorenz wrote: Hi, I send the radio-si470x patches worked on http://linuxtv.org/hg/v4l-dvb. The patches is updated to version 2. The patchset looks good. I'll give my feedback in the following mails. Tobias informed me the base code for seperating at http://linuxtv.org/hg/~tlorenz/v4l-dvb of Tobias repository in above mail, i based on it, but it cannot find now at Tobias repository. Before sending a pull request, I usually clean up the archive from any other patches. But nevertheless, you and me still have the I2C patches. They now reached a quality to finally bring them in the kernel. Good work. Thanks. I am concerned about one thing. I cannot test the si470x usb radio driver because i don't have the si470x usb radio device, so i believe you would have probably tested it. The patch 1/4 is for separating common and usb code. The patch 2/4 is about using dev_* macro instead of printk. The patch 3/4 is about adding disconnect check function for i2c interface. The patch 4/4 is for supporting si470x i2c interface. Bye, Toby -- 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 v2 4/4] radio-si470x: add i2c driver for si470x
snip + +int si470x_disconnect_check(struct si470x_device *radio) +{ + return 0; +} Looks like this function is empty and it's called few times. Is it good to make it inline? Yes, this function is empty. It looks fine to me too. I will modify it, thanks. -- 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 0/2] radio-si470x: separate usb and i2c interface
Hi, all I send the radio-si470x patches worked on http://linuxtv.org/hg/v4l-dvb. I have a board with Silicon Labs si4709 chip using the i2c interface, but the radio-si470x is only support usb interface currently. I posted about separating usb and i2c interface in radio-si470x the past. http://www.mail-archive.com/linux-media@vger.kernel.org/msg02483.html Tobias informed me the base code for seperating at http://linuxtv.org/hg/~tlorenz/v4l-dvb of Tobias repository in above mail, i based on it, but it cannot find now at Tobias repository. The patch 1/2 is for separating common and usb code, and the patch 2/2 is for supporting si470x i2c interface. Please review, thank you. -- 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 2/2] radio-si470x: add i2c driver for si470x
This patch supports i2c interface of si470x. The i2c specific part exists in radio-si470x-i2c.c file and the common part uses radio-si470x-common.c file. The '#if defined' is inserted inevitably because of parts used only si470x usb in the common file. The current driver version doesn't support the RDS. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- linux/drivers/media/radio/si470x/Kconfig | 13 + linux/drivers/media/radio/si470x/Makefile |2 + .../media/radio/si470x/radio-si470x-common.c | 24 ++ .../drivers/media/radio/si470x/radio-si470x-i2c.c | 250 linux/drivers/media/radio/si470x/radio-si470x.h|6 + 5 files changed, 295 insertions(+), 0 deletions(-) create mode 100644 linux/drivers/media/radio/si470x/radio-si470x-i2c.c diff --git a/linux/drivers/media/radio/si470x/Kconfig b/linux/drivers/media/radio/si470x/Kconfig index 20d05c0..a466654 100644 --- a/linux/drivers/media/radio/si470x/Kconfig +++ b/linux/drivers/media/radio/si470x/Kconfig @@ -22,3 +22,16 @@ config USB_SI470X To compile this driver as a module, choose M here: the module will be called radio-usb-si470x. + +config I2C_SI470X + tristate Silicon Labs Si470x FM Radio Receiver support with I2C + depends on I2C RADIO_SI470X !USB_SI470X + ---help--- + This is a driver for I2C devices with the Silicon Labs SI470x + chip. + + Say Y here if you want to connect this type of radio to your + computer's I2C port. + + To compile this driver as a module, choose M here: the + module will be called radio-i2c-si470x. diff --git a/linux/drivers/media/radio/si470x/Makefile b/linux/drivers/media/radio/si470x/Makefile index 3cb777f..0696481 100644 --- a/linux/drivers/media/radio/si470x/Makefile +++ b/linux/drivers/media/radio/si470x/Makefile @@ -3,5 +3,7 @@ # radio-usb-si470x-objs := radio-si470x-usb.o radio-si470x-common.o +radio-i2c-si470x-objs := radio-si470x-i2c.o radio-si470x-common.o obj-$(CONFIG_USB_SI470X) += radio-usb-si470x.o +obj-$(CONFIG_I2C_SI470X) += radio-i2c-si470x.o diff --git a/linux/drivers/media/radio/si470x/radio-si470x-common.c b/linux/drivers/media/radio/si470x/radio-si470x-common.c index d2dc1ff..77f79e7 100644 --- a/linux/drivers/media/radio/si470x/radio-si470x-common.c +++ b/linux/drivers/media/radio/si470x/radio-si470x-common.c @@ -473,11 +473,13 @@ static int si470x_vidioc_g_ctrl(struct file *file, void *priv, struct si470x_device *radio = video_drvdata(file); int retval = 0; +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) /* safety checks */ if (radio-disconnected) { retval = -EIO; goto done; } +#endif switch (ctrl-id) { case V4L2_CID_AUDIO_VOLUME: @@ -492,7 +494,9 @@ static int si470x_vidioc_g_ctrl(struct file *file, void *priv, retval = -EINVAL; } +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) done: +#endif if (retval 0) printk(KERN_WARNING DRIVER_NAME : get control failed with %d\n, retval); @@ -509,11 +513,13 @@ static int si470x_vidioc_s_ctrl(struct file *file, void *priv, struct si470x_device *radio = video_drvdata(file); int retval = 0; +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) /* safety checks */ if (radio-disconnected) { retval = -EIO; goto done; } +#endif switch (ctrl-id) { case V4L2_CID_AUDIO_VOLUME: @@ -532,7 +538,9 @@ static int si470x_vidioc_s_ctrl(struct file *file, void *priv, retval = -EINVAL; } +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) done: +#endif if (retval 0) printk(KERN_WARNING DRIVER_NAME : set control failed with %d\n, retval); @@ -566,10 +574,12 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, int retval = 0; /* safety checks */ +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) if (radio-disconnected) { retval = -EIO; goto done; } +#endif if (tuner-index != 0) { retval = -EINVAL; goto done; @@ -582,8 +592,12 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, /* driver constants */ strcpy(tuner-name, FM); tuner-type = V4L2_TUNER_RADIO; +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) tuner-capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS; +#else + tuner-capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; +#endif /* range limits */ switch ((radio-registers[SYSCONFIG2] SYSCONFIG2_BAND) 6) { @@ -609,10
Re: [PATCH 2/2] radio-si470x: add i2c driver for si470x
Hi, Alexey. snip diff --git a/linux/drivers/media/radio/si470x/radio-si470x-common.c b/linux/drivers/media/radio/si470x/radio-si470x-common.c index d2dc1ff..77f79e7 100644 --- a/linux/drivers/media/radio/si470x/radio-si470x-common.c +++ b/linux/drivers/media/radio/si470x/radio-si470x-common.c @@ -473,11 +473,13 @@ static int si470x_vidioc_g_ctrl(struct file *file, void *priv, struct si470x_device *radio = video_drvdata(file); int retval = 0; +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) /* safety checks */ if (radio-disconnected) { retval = -EIO; goto done; } +#endif I'm sorry for asking but is it possible to turn this into separate macro? Something like this for example: /* comment about macro */ #if defined (CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) #define safety_check() if() { ... checks ... } #elseif #define safety_check() #endif to run away from many #if defined-#endif constructions in source code. Is it really good to redesign this or am i wrong here? I think your example is better, i will try it. snip +static int __init si470x_i2c_init(void) +{ +return i2c_add_driver(si470x_i2c_driver); +} +module_init(si470x_i2c_init); + +static void __exit si470x_i2c_exit(void) +{ +i2c_del_driver(si470x_i2c_driver); +} +module_exit(si470x_i2c_exit); + +MODULE_DESCRIPTION(i2c radio driver for si470x fm radio receivers); +MODULE_AUTHOR(Joonyoung Shim jy0922.s...@samsung.com); +MODULE_LICENSE(GPL); Please, move this information to the top of file to see this information fast when you suddenly open source file. I'm not sure about this because many linux drivers have the module information at the bottom of file. -- 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 v2 0/4] radio-si470x: separate usb and i2c interface
Hi, all I send the radio-si470x patches worked on http://linuxtv.org/hg/v4l-dvb. The patches is updated to version 2. I have a board with Silicon Labs si4709 chip using the i2c interface, but the radio-si470x is only support usb interface currently. I posted about separating usb and i2c interface in radio-si470x the past. http://www.mail-archive.com/linux-media@vger.kernel.org/msg02483.html Tobias informed me the base code for seperating at http://linuxtv.org/hg/~tlorenz/v4l-dvb of Tobias repository in above mail, i based on it, but it cannot find now at Tobias repository. The patch 1/4 is for separating common and usb code. The patch 2/4 is about using dev_* macro instead of printk. The patch 3/4 is about adding disconnect check function for i2c interface. The patch 4/4 is for supporting si470x i2c interface. Please review, thank you. -- 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 v2 2/4] radio-si470x: change to dev_* macro from printk
This patch is for using dev_* macro instead of printk. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- .../media/radio/si470x/radio-si470x-common.c | 50 +- .../drivers/media/radio/si470x/radio-si470x-usb.c | 58 +--- 2 files changed, 52 insertions(+), 56 deletions(-) diff --git a/linux/drivers/media/radio/si470x/radio-si470x-common.c b/linux/drivers/media/radio/si470x/radio-si470x-common.c index d2dc1ff..2be22bd 100644 --- a/linux/drivers/media/radio/si470x/radio-si470x-common.c +++ b/linux/drivers/media/radio/si470x/radio-si470x-common.c @@ -184,10 +184,10 @@ static int si470x_set_chan(struct si470x_device *radio, unsigned short chan) } while (((radio-registers[STATUSRSSI] STATUSRSSI_STC) == 0) (!timed_out)); if ((radio-registers[STATUSRSSI] STATUSRSSI_STC) == 0) - printk(KERN_WARNING DRIVER_NAME : tune does not complete\n); + dev_warn(radio-videodev-dev, tune does not complete\n); if (timed_out) - printk(KERN_WARNING DRIVER_NAME - : tune timed out after %u ms\n, tune_timeout); + dev_warn(radio-videodev-dev, + tune timed out after %u ms\n, tune_timeout); stop: /* stop tuning */ @@ -320,13 +320,13 @@ static int si470x_set_seek(struct si470x_device *radio, } while (((radio-registers[STATUSRSSI] STATUSRSSI_STC) == 0) (!timed_out)); if ((radio-registers[STATUSRSSI] STATUSRSSI_STC) == 0) - printk(KERN_WARNING DRIVER_NAME : seek does not complete\n); + dev_warn(radio-videodev-dev, seek does not complete\n); if (radio-registers[STATUSRSSI] STATUSRSSI_SF) - printk(KERN_WARNING DRIVER_NAME - : seek failed / band limit reached\n); + dev_warn(radio-videodev-dev, + seek failed / band limit reached\n); if (timed_out) - printk(KERN_WARNING DRIVER_NAME - : seek timed out after %u ms\n, seek_timeout); + dev_warn(radio-videodev-dev, + seek timed out after %u ms\n, seek_timeout); stop: /* stop seeking */ @@ -435,6 +435,7 @@ int si470x_rds_on(struct si470x_device *radio) static int si470x_vidioc_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *qc) { + struct si470x_device *radio = video_drvdata(file); int retval = -EINVAL; /* abort if qc-id is below V4L2_CID_BASE */ @@ -458,8 +459,8 @@ static int si470x_vidioc_queryctrl(struct file *file, void *priv, done: if (retval 0) - printk(KERN_WARNING DRIVER_NAME - : query controls failed with %d\n, retval); + dev_warn(radio-videodev-dev, + query controls failed with %d\n, retval); return retval; } @@ -494,8 +495,8 @@ static int si470x_vidioc_g_ctrl(struct file *file, void *priv, done: if (retval 0) - printk(KERN_WARNING DRIVER_NAME - : get control failed with %d\n, retval); + dev_warn(radio-videodev-dev, + get control failed with %d\n, retval); return retval; } @@ -534,8 +535,8 @@ static int si470x_vidioc_s_ctrl(struct file *file, void *priv, done: if (retval 0) - printk(KERN_WARNING DRIVER_NAME - : set control failed with %d\n, retval); + dev_warn(radio-videodev-dev, + set control failed with %d\n, retval); return retval; } @@ -632,8 +633,8 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, done: if (retval 0) - printk(KERN_WARNING DRIVER_NAME - : get tuner failed with %d\n, retval); + dev_warn(radio-videodev-dev, + get tuner failed with %d\n, retval); return retval; } @@ -671,8 +672,8 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv, done: if (retval 0) - printk(KERN_WARNING DRIVER_NAME - : set tuner failed with %d\n, retval); + dev_warn(radio-videodev-dev, + set tuner failed with %d\n, retval); return retval; } @@ -701,8 +702,8 @@ static int si470x_vidioc_g_frequency(struct file *file, void *priv, done: if (retval 0) - printk(KERN_WARNING DRIVER_NAME - : get frequency failed with %d\n, retval); + dev_warn(radio-videodev-dev, + get frequency failed with %d\n, retval); return retval; } @@ -730,8 +731,8 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv, done: if (retval 0) - printk(KERN_WARNING DRIVER_NAME - : set
[PATCH v2 3/4] radio-si470x: add disconnect check function
The si470x_disconnect_check is function to check disconnect state of radio in common file. The function is implemented in each interface file. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- .../media/radio/si470x/radio-si470x-common.c | 40 +-- .../drivers/media/radio/si470x/radio-si470x-usb.c | 17 linux/drivers/media/radio/si470x/radio-si470x.h|1 + 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/linux/drivers/media/radio/si470x/radio-si470x-common.c b/linux/drivers/media/radio/si470x/radio-si470x-common.c index 2be22bd..84cbea3 100644 --- a/linux/drivers/media/radio/si470x/radio-si470x-common.c +++ b/linux/drivers/media/radio/si470x/radio-si470x-common.c @@ -475,10 +475,9 @@ static int si470x_vidioc_g_ctrl(struct file *file, void *priv, int retval = 0; /* safety checks */ - if (radio-disconnected) { - retval = -EIO; + retval = si470x_disconnect_check(radio); + if (retval) goto done; - } switch (ctrl-id) { case V4L2_CID_AUDIO_VOLUME: @@ -511,10 +510,9 @@ static int si470x_vidioc_s_ctrl(struct file *file, void *priv, int retval = 0; /* safety checks */ - if (radio-disconnected) { - retval = -EIO; + retval = si470x_disconnect_check(radio); + if (retval) goto done; - } switch (ctrl-id) { case V4L2_CID_AUDIO_VOLUME: @@ -567,10 +565,10 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, int retval = 0; /* safety checks */ - if (radio-disconnected) { - retval = -EIO; + retval = si470x_disconnect_check(radio); + if (retval) goto done; - } + if (tuner-index != 0) { retval = -EINVAL; goto done; @@ -649,10 +647,10 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv, int retval = -EINVAL; /* safety checks */ - if (radio-disconnected) { - retval = -EIO; + retval = si470x_disconnect_check(radio); + if (retval) goto done; - } + if (tuner-index != 0) goto done; @@ -688,10 +686,10 @@ static int si470x_vidioc_g_frequency(struct file *file, void *priv, int retval = 0; /* safety checks */ - if (radio-disconnected) { - retval = -EIO; + retval = si470x_disconnect_check(radio); + if (retval) goto done; - } + if (freq-tuner != 0) { retval = -EINVAL; goto done; @@ -718,10 +716,10 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv, int retval = 0; /* safety checks */ - if (radio-disconnected) { - retval = -EIO; + retval = si470x_disconnect_check(radio); + if (retval) goto done; - } + if (freq-tuner != 0) { retval = -EINVAL; goto done; @@ -747,10 +745,10 @@ static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv, int retval = 0; /* safety checks */ - if (radio-disconnected) { - retval = -EIO; + retval = si470x_disconnect_check(radio); + if (retval) goto done; - } + if (seek-tuner != 0) { retval = -EINVAL; goto done; diff --git a/linux/drivers/media/radio/si470x/radio-si470x-usb.c b/linux/drivers/media/radio/si470x/radio-si470x-usb.c index 6508161..2f5cf6c 100644 --- a/linux/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/linux/drivers/media/radio/si470x/radio-si470x-usb.c @@ -371,6 +371,23 @@ static int si470x_get_scratch_page_versions(struct si470x_device *radio) /** + * General Driver Functions - DISCONNECT_CHECK + **/ + +/* + * si470x_disconnect_check - check whether radio disconnects + */ +int si470x_disconnect_check(struct si470x_device *radio) +{ + if (radio-disconnected) + return -EIO; + else + return 0; +} + + + +/** * RDS Driver Functions **/ diff --git a/linux/drivers/media/radio/si470x/radio-si470x.h b/linux/drivers/media/radio/si470x/radio-si470x.h index 6b85315..6305f6b 100644 --- a/linux/drivers/media/radio/si470x/radio-si470x.h +++ b/linux/drivers/media/radio/si470x/radio-si470x.h @@ -193,6 +193,7 @@ extern const struct v4l2_file_operations si470x_fops; extern struct video_device si470x_viddev_template; int si470x_get_register(struct si470x_device *radio, int regnr); int si470x_set_register(struct si470x_device *radio
[PATCH v2 4/4] radio-si470x: add i2c driver for si470x
This patch supports i2c interface of si470x. The i2c specific part exists in radio-si470x-i2c.c file and the common part uses radio-si470x-common.c file. The '#if defined' is inserted inevitably because of parts used only si470x usb in the common file. The current driver version doesn't support the RDS. Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- linux/drivers/media/radio/si470x/Kconfig | 13 + linux/drivers/media/radio/si470x/Makefile |2 + .../media/radio/si470x/radio-si470x-common.c |6 + .../drivers/media/radio/si470x/radio-si470x-i2c.c | 254 linux/drivers/media/radio/si470x/radio-si470x.h|6 + 5 files changed, 281 insertions(+), 0 deletions(-) create mode 100644 linux/drivers/media/radio/si470x/radio-si470x-i2c.c diff --git a/linux/drivers/media/radio/si470x/Kconfig b/linux/drivers/media/radio/si470x/Kconfig index 20d05c0..a466654 100644 --- a/linux/drivers/media/radio/si470x/Kconfig +++ b/linux/drivers/media/radio/si470x/Kconfig @@ -22,3 +22,16 @@ config USB_SI470X To compile this driver as a module, choose M here: the module will be called radio-usb-si470x. + +config I2C_SI470X + tristate Silicon Labs Si470x FM Radio Receiver support with I2C + depends on I2C RADIO_SI470X !USB_SI470X + ---help--- + This is a driver for I2C devices with the Silicon Labs SI470x + chip. + + Say Y here if you want to connect this type of radio to your + computer's I2C port. + + To compile this driver as a module, choose M here: the + module will be called radio-i2c-si470x. diff --git a/linux/drivers/media/radio/si470x/Makefile b/linux/drivers/media/radio/si470x/Makefile index 3cb777f..0696481 100644 --- a/linux/drivers/media/radio/si470x/Makefile +++ b/linux/drivers/media/radio/si470x/Makefile @@ -3,5 +3,7 @@ # radio-usb-si470x-objs := radio-si470x-usb.o radio-si470x-common.o +radio-i2c-si470x-objs := radio-si470x-i2c.o radio-si470x-common.o obj-$(CONFIG_USB_SI470X) += radio-usb-si470x.o +obj-$(CONFIG_I2C_SI470X) += radio-i2c-si470x.o diff --git a/linux/drivers/media/radio/si470x/radio-si470x-common.c b/linux/drivers/media/radio/si470x/radio-si470x-common.c index 84cbea3..0a48159 100644 --- a/linux/drivers/media/radio/si470x/radio-si470x-common.c +++ b/linux/drivers/media/radio/si470x/radio-si470x-common.c @@ -581,8 +581,12 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, /* driver constants */ strcpy(tuner-name, FM); tuner-type = V4L2_TUNER_RADIO; +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) tuner-capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS; +#else + tuner-capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; +#endif /* range limits */ switch ((radio-registers[SYSCONFIG2] SYSCONFIG2_BAND) 6) { @@ -608,10 +612,12 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, tuner-rxsubchans = V4L2_TUNER_SUB_MONO; else tuner-rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; +#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE) /* If there is a reliable method of detecting an RDS channel, then this code should check for that before setting this RDS subchannel. */ tuner-rxsubchans |= V4L2_TUNER_SUB_RDS; +#endif /* mono/stereo selector */ if ((radio-registers[POWERCFG] POWERCFG_MONO) == 0) diff --git a/linux/drivers/media/radio/si470x/radio-si470x-i2c.c b/linux/drivers/media/radio/si470x/radio-si470x-i2c.c new file mode 100644 index 000..2181021 --- /dev/null +++ b/linux/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -0,0 +1,254 @@ +/* + * drivers/media/radio/si470x/radio-si470x-i2c.c + * + * I2C driver for radios with Silicon Labs Si470x FM Radio Receivers + * + * Copyright (C) 2009 Samsung Electronics Co.Ltd + * Author: Joonyoung Shim jy0922.s...@samsung.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. + * + * + * TODO: + * - RDS support + * + */ + +#include linux/module.h +#include linux/init.h +#include linux/i2c.h +#include linux/delay.h + +#include radio-si470x.h + +#define DRIVER_KERNEL_VERSION KERNEL_VERSION(1, 0, 0) +#define DRIVER_CARDSilicon Labs Si470x FM Radio Receiver +#define DRIVER_VERSION 1.0.0 + +/* starting with the upper byte of register 0x0a */ +#define READ_REG_NUM RADIO_REGISTER_NUM +#define READ_INDEX(i) ((i + RADIO_REGISTER_NUM - 0x0a) % READ_REG_NUM) + +static int si470x_get_all_registers(struct si470x_device *radio) +{ + int i; + u16 buf
Re: About the radio-si470x driver for I2C interface
I'm not sure about the consequences in case of renaming the radio-si470x module. But it would be consequent to add the appendix -usb and -i2c to the current name. I applied the patch as follows: Okay, your patch is better. Thanks. I will post the i2c part soon after testing. -- 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: About the radio-si470x driver for I2C interface
On 4/13/2009 7:31 PM, Joonyoung Shim wrote: I'm not sure about the consequences in case of renaming the radio-si470x module. But it would be consequent to add the appendix -usb and -i2c to the current name. I applied the patch as follows: Okay, your patch is better. Thanks. I will post the i2c part soon after testing. I have some problem. There is codes for usb in radio-si470x-common.c file. Hrm, if it cannot be removed, maybe it seems to seperate using ifdef. What do you think about this? -- 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: About the radio-si470x driver for I2C interface
On 4/14/2009 3:35 AM, Tobias Lorenz wrote: Hi Joonyoung, I have some problem. There is codes for usb in radio-si470x-common.c file. Hrm, if it cannot be removed, maybe it seems to seperate using ifdef. What do you think about this? I moved some more functions from radio-si470x-common.c file to radio-si470x-usb.c: - si470x_start - si470x_stop - si470x_fops_open - si470x_fops_release Now the common file should be free of any USB specific components. Please have a look at http://linuxtv.org/hg/~tlorenz/v4l-dvb/ Maybe we can move something back later for optimization. But for now, it should be okay. Bye, Toby Hi Tobias, I have some questions. The i2c device is connected always unlike the usb device, so it doesn't use disconnected and disconnect_lock of struct si470x_device, these are usb specific. Unlike you say, si470x_start and si470x_stop functions exist yet in radio-si470x-common.c. I know from datasheet that software should wait for the powerup time(110ms) after power up, and i verified it at the si4709 device using i2c interface, but there is not at your implementation. I wonder above things, and i send you the patch to fix make warning and build errors, and for easy work. = Fix compile warnings and errors of radio-si470x-i2c Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com --- linux/drivers/media/radio/si470x/Kconfig |2 +- linux/drivers/media/radio/si470x/Makefile |4 +- .../drivers/media/radio/si470x/radio-si470x-i2c.c | 153 +--- linux/drivers/media/radio/si470x/radio-si470x.h|5 +- 4 files changed, 74 insertions(+), 90 deletions(-) diff --git a/linux/drivers/media/radio/si470x/Kconfig b/linux/drivers/media/radio/si470x/Kconfig index 3172e1a..07ac2d3 100644 --- a/linux/drivers/media/radio/si470x/Kconfig +++ b/linux/drivers/media/radio/si470x/Kconfig @@ -34,4 +34,4 @@ config I2C_SI470X computer's I2C port. To compile this driver as a module, choose M here: the - module will be called radio-si470x-i2c. + module will be called radio-i2c-si470x. diff --git a/linux/drivers/media/radio/si470x/Makefile b/linux/drivers/media/radio/si470x/Makefile index 945e7b1..a4bba94 100644 --- a/linux/drivers/media/radio/si470x/Makefile +++ b/linux/drivers/media/radio/si470x/Makefile @@ -3,7 +3,7 @@ # radio-si470x-objs := radio-si470x-usb.o radio-si470x-common.o -radio-si470x-i2c-objs := radio-si470x-i2c.o radio-si470x-common.o +radio-i2c-si470x-objs := radio-si470x-i2c.o radio-si470x-common.o obj-$(CONFIG_USB_SI470X) += radio-si470x.o -obj-$(CONFIG_I2C_SI470X) += radio-si470x-i2c.o +obj-$(CONFIG_I2C_SI470X) += radio-i2c-si470x.o diff --git a/linux/drivers/media/radio/si470x/radio-si470x-i2c.c b/linux/drivers/media/radio/si470x/radio-si470x-i2c.c index 7058b84..27a0691 100644 --- a/linux/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/linux/drivers/media/radio/si470x/radio-si470x-i2c.c @@ -57,14 +57,9 @@ MODULE_PARM_DESC(radio_nr, Radio Nr); */ int si470x_get_register(struct si470x_device *radio, int regnr) { - int retval; + /* TODO */ - retval = 0; /* TODO */ - - if (retval = 0) - radio-registers[regnr] = 0; /* TODO */ - - return (retval 0) ? -EINVAL : 0; + return 0; } @@ -73,13 +68,9 @@ int si470x_get_register(struct si470x_device *radio, int regnr) */ int si470x_set_register(struct si470x_device *radio, int regnr) { - int retval; - - radio-registers[regnr] = 0; /* TODO */ + /* TODO */ - retval = 0; /* TODO */ - - return (retval 0) ? -EINVAL : 0; + return 0; } @@ -88,16 +79,9 @@ int si470x_set_register(struct si470x_device *radio, int regnr) */ int si470x_get_all_registers(struct si470x_device *radio) { - int retval; - unsigned char regnr; - - retval = 0; /* TODO */ + /* TODO */ - if (retval = 0) - for (regnr = 0; regnr RADIO_REGISTER_NUM; regnr++) - radio-registers[regnr] = 0; /* TODO */ - - return (retval 0) ? -EINVAL : 0; + return 0; } @@ -106,17 +90,9 @@ int si470x_get_all_registers(struct si470x_device *radio) */ int si470x_get_rds_registers(struct si470x_device *radio) { - int retval; - int size; - unsigned char regnr; - - retval = /* TODO */ + /* TODO */ - if (retval = 0) - for (regnr = 0; regnr RDS_REGISTER_NUM; regnr++) - radio-registers[STATUSRSSI + regnr] = 0; /* TODO */ - - return (retval 0) ? -EINVAL : 0; + return 0; } @@ -131,26 +107,15 @@ int si470x_get_rds_registers(struct si470x_device *radio) int si470x_fops_open(struct file *file) { struct si470x_device *radio = video_drvdata(file); - int retval; + int retval = 0; lock_kernel
Re: About the radio-si470x driver for I2C interface
On 4/13/2009 5:56 AM, Tobias Lorenz wrote: Hi Joonyoung, Hi Alexey, I've split the driver into a couple of segments: - radio-si470x-common.c is for common functions - radio-si470x-usb.c are the usb support functions - radio-si470x-i2c.c is an untested prototyped file for your i2c support functions - radio-si470x.h is a header file with everything required by the c-files I hope this is a basis we can start on with i2c support. What do you think? The URL is: http://linuxtv.org/hg/~tlorenz/v4l-dvb It looks good, i will test with implementing the i2c functions. Thanks. -- 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: About the radio-si470x driver for I2C interface
On 4/13/2009 10:46 AM, Joonyoung Shim wrote: On 4/13/2009 5:56 AM, Tobias Lorenz wrote: Hi Joonyoung, Hi Alexey, I've split the driver into a couple of segments: - radio-si470x-common.c is for common functions - radio-si470x-usb.c are the usb support functions - radio-si470x-i2c.c is an untested prototyped file for your i2c support functions - radio-si470x.h is a header file with everything required by the c-files I hope this is a basis we can start on with i2c support. What do you think? The URL is: http://linuxtv.org/hg/~tlorenz/v4l-dvb It looks good, i will test with implementing the i2c functions. I compiled getting your source from above URL, but i could not compile because of supporting only usb compilation at Makefile. I suggest to modify at Kconfig and Makefile like following patch. What do you think? diff -r 43d455adb02c linux/drivers/media/radio/Makefile --- a/linux/drivers/media/radio/MakefileSun Apr 12 22:51:40 2009 +0200 +++ b/linux/drivers/media/radio/MakefileMon Apr 13 14:31:05 2009 +0900 @@ -17,7 +17,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o obj-$(CONFIG_USB_DSBR) += dsbr100.o -obj-$(CONFIG_USB_SI470X) += si470x/ +obj-$(CONFIG_RADIO_SI470X) += si470x/ obj-$(CONFIG_USB_MR800) += radio-mr800.o obj-$(CONFIG_RADIO_TEA5764) += radio-tea5764.o diff -r 43d455adb02c linux/drivers/media/radio/si470x/Kconfig --- a/linux/drivers/media/radio/si470x/Kconfig Sun Apr 12 22:51:40 2009 +0200 +++ b/linux/drivers/media/radio/si470x/Kconfig Mon Apr 13 14:31:05 2009 +0900 @@ -1,6 +1,10 @@ +config RADIO_SI470X + tristate Silicon Labs Si470x FM Radio Receiver support + depends on VIDEO_V4L2 + config USB_SI470X tristate Silicon Labs Si470x FM Radio Receiver support with USB - depends on USB VIDEO_V4L2 + depends on USB RADIO_SI470X ---help--- This is a driver for USB devices with the Silicon Labs SI470x chip. Currently these devices are known to work: @@ -25,7 +29,7 @@ config I2C_SI470X tristate Silicon Labs Si470x FM Radio Receiver support with I2C - depends on I2C VIDEO_V4L2 + depends on I2C RADIO_SI470X ---help--- This is a driver for I2C devices with the Silicon Labs SI470x chip. diff -r 43d455adb02c linux/drivers/media/radio/si470x/Makefile --- a/linux/drivers/media/radio/si470x/Makefile Sun Apr 12 22:51:40 2009 +0200 +++ b/linux/drivers/media/radio/si470x/Makefile Mon Apr 13 14:31:05 2009 +0900 @@ -2,8 +2,8 @@ # Makefile for radios with Silicon Labs Si470x FM Radio Receivers # -radio-si470x-objs := radio-si470x-usb.o radio-si470x-common.o -radio-si470x-i2c-objs := radio-si470x-i2c.o radio-si470x-common.o +si470x-usb-objs:= radio-si470x-usb.o radio-si470x-common.o +si470x-i2c-objs:= radio-si470x-i2c.o radio-si470x-common.o -obj-$(CONFIG_USB_SI470X) += radio-si470x.o -obj-$(CONFIG_I2C_SI470X) += radio-si470x-i2c.o +obj-$(CONFIG_USB_SI470X) += si470x-usb.o +obj-$(CONFIG_I2C_SI470X) += si470x-i2c.o Thanks. -- 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: About the radio-si470x driver for I2C interface
Hello On Tue, Mar 10, 2009 at 3:20 AM, Mauro Carvalho Chehab mche...@infradead.org wrote: On Mon, 9 Mar 2009 23:33:38 +0100 Tobias Lorenz tobias.lor...@gmx.net wrote: Hi, The proper way is to break radio-si470x into two parts: - A i2c adapter driver (similar to what we have on cx88-i2c, for example, plus the radio part of cx88-video); - A radio driver (similar to tea5767.c). This way, the i2c driver can be used on designs that use a different i2c adapter. yes, this is why I already capsulated most of the USB functionality into own functions. I awaited that somewhen the si470x is used in the usual way by i2c. I'm not sure, if we should split the driver into three files (generic/common, usb, i2c) or just implement the new functionality within the same file using macros/defines. It is better to split. It will provide more flexibility. Tobias, Joonyoung Is there any success on this ? Hi, I have tried, but could not do it yet. Like radio-tea5764.c, radio-si470x driver for I2C interface also was implemented as the I2C driver, but it has many redundant functions with the existing radio-si470x for USB interface, so I tried to join two interfaces but it was a difficult work. I have never seen the linux device driver probing more than one interface optionally. -- Joonyoung Shim -- Best regards, Klimov Alexey -- 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
About the radio-si470x driver for I2C interface
Hi all, I have worked with Silicon Labs Si4709 chip using the I2C interface. There is the radio-si470x driver in linux-kernel, but it uses usb interface. First, i made a new file based on radio-si470x.c in driver/media/radio/ for si4709 i2c driver and modified it to use i2c interface instead of usb interface and could listen to FM radio station. I think it can be to join two things together to one file because there isn't the difference between the two except for the interface. I am considering how to integrate them. Please send your opinion. -- - Joonyoung Shim -- 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