Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] v4l: s5p-tv: hdmi: add support for platform data

Moving configuration of s5p-hdmi peripherals from driver data to
platfrom data.

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Tomasz Stanislawski and committed by
Mauro Carvalho Chehab
350f2f4d 56e1df49

+52 -21
+17 -21
drivers/media/video/s5p-tv/hdmi_drv.c
··· 30 30 #include <linux/clk.h> 31 31 #include <linux/regulator/consumer.h> 32 32 33 + #include <media/s5p_hdmi.h> 33 34 #include <media/v4l2-common.h> 34 35 #include <media/v4l2-dev.h> 35 36 #include <media/v4l2-device.h> ··· 73 72 u32 cur_preset; 74 73 /** other resources */ 75 74 struct hdmi_resources res; 76 - }; 77 - 78 - struct hdmi_driver_data { 79 - int hdmiphy_bus; 80 75 }; 81 76 82 77 struct hdmi_tg_regs { ··· 126 129 struct v4l2_mbus_framefmt mbus_fmt; 127 130 }; 128 131 129 - /* I2C module and id for HDMIPHY */ 130 - static struct i2c_board_info hdmiphy_info = { 131 - I2C_BOARD_INFO("hdmiphy", 0x38), 132 - }; 133 - 134 - static struct hdmi_driver_data hdmi_driver_data[] = { 135 - { .hdmiphy_bus = 3 }, 136 - { .hdmiphy_bus = 8 }, 137 - }; 138 - 139 132 static struct platform_device_id hdmi_driver_types[] = { 140 133 { 141 134 .name = "s5pv210-hdmi", 142 - .driver_data = (unsigned long)&hdmi_driver_data[0], 143 135 }, { 144 136 .name = "exynos4-hdmi", 145 - .driver_data = (unsigned long)&hdmi_driver_data[1], 146 137 }, { 147 138 /* end node */ 148 139 } ··· 855 870 struct i2c_adapter *phy_adapter; 856 871 struct v4l2_subdev *sd; 857 872 struct hdmi_device *hdmi_dev = NULL; 858 - struct hdmi_driver_data *drv_data; 873 + struct s5p_hdmi_platform_data *pdata = dev->platform_data; 859 874 int ret; 860 875 861 876 dev_dbg(dev, "probe start\n"); 877 + 878 + if (!pdata) { 879 + dev_err(dev, "platform data is missing\n"); 880 + ret = -ENODEV; 881 + goto fail; 882 + } 862 883 863 884 hdmi_dev = devm_kzalloc(&pdev->dev, sizeof(*hdmi_dev), GFP_KERNEL); 864 885 if (!hdmi_dev) { ··· 920 929 goto fail_init; 921 930 } 922 931 923 - drv_data = (struct hdmi_driver_data *) 924 - platform_get_device_id(pdev)->driver_data; 925 - phy_adapter = i2c_get_adapter(drv_data->hdmiphy_bus); 932 + /* testing if hdmiphy info is present */ 933 + if (!pdata->hdmiphy_info) { 934 + dev_err(dev, "hdmiphy info is missing in platform data\n"); 935 + ret = -ENXIO; 936 + goto fail_vdev; 937 + } 938 + 939 + phy_adapter = i2c_get_adapter(pdata->hdmiphy_bus); 926 940 if (phy_adapter == NULL) { 927 941 dev_err(dev, "adapter request failed\n"); 928 942 ret = -ENXIO; ··· 935 939 } 936 940 937 941 hdmi_dev->phy_sd = v4l2_i2c_new_subdev_board(&hdmi_dev->v4l2_dev, 938 - phy_adapter, &hdmiphy_info, NULL); 942 + phy_adapter, pdata->hdmiphy_info, NULL); 939 943 /* on failure or not adapter is no longer useful */ 940 944 i2c_put_adapter(phy_adapter); 941 945 if (hdmi_dev->phy_sd == NULL) {
+35
include/media/s5p_hdmi.h
··· 1 + /* 2 + * Driver header for S5P HDMI chip. 3 + * 4 + * Copyright (c) 2011 Samsung Electronics, Co. Ltd 5 + * Contact: Tomasz Stanislawski <t.stanislaws@samsung.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or 10 + * (at your option) any later version. 11 + */ 12 + 13 + #ifndef S5P_HDMI_H 14 + #define S5P_HDMI_H 15 + 16 + struct i2c_board_info; 17 + 18 + /** 19 + * @hdmiphy_bus: controller id for HDMIPHY bus 20 + * @hdmiphy_info: template for HDMIPHY I2C device 21 + * @mhl_bus: controller id for MHL control bus 22 + * @mhl_info: template for MHL I2C device 23 + * 24 + * NULL pointer for *_info fields indicates that 25 + * the corresponding chip is not present 26 + */ 27 + struct s5p_hdmi_platform_data { 28 + int hdmiphy_bus; 29 + struct i2c_board_info *hdmiphy_info; 30 + int mhl_bus; 31 + struct i2c_board_info *mhl_info; 32 + }; 33 + 34 + #endif /* S5P_HDMI_H */ 35 +