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

[media] tua9001: various minor changes

Fix logging. Style issues. Rename things.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Antti Palosaari and committed by
Mauro Carvalho Chehab
465433fa 96676239

+83 -94
+1 -1
drivers/media/tuners/Kconfig
··· 234 234 Montage M88RS6000 internal tuner. 235 235 236 236 config MEDIA_TUNER_TUA9001 237 - tristate "Infineon TUA 9001 silicon tuner" 237 + tristate "Infineon TUA9001 silicon tuner" 238 238 depends on MEDIA_SUPPORT && I2C 239 239 default m if !MEDIA_SUBDRV_AUTOSELECT 240 240 help
+75 -78
drivers/media/tuners/tua9001.c
··· 1 1 /* 2 - * Infineon TUA 9001 silicon tuner driver 2 + * Infineon TUA9001 silicon tuner driver 3 3 * 4 4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi> 5 5 * ··· 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License along 17 - * with this program; if not, write to the Free Software Foundation, Inc., 18 - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 15 */ 20 16 21 - #include "tua9001.h" 22 17 #include "tua9001_priv.h" 23 18 24 19 /* write register */ 25 - static int tua9001_wr_reg(struct tua9001_priv *priv, u8 reg, u16 val) 20 + static int tua9001_wr_reg(struct tua9001_dev *dev, u8 reg, u16 val) 26 21 { 22 + struct i2c_client *client = dev->client; 27 23 int ret; 28 24 u8 buf[3] = { reg, (val >> 8) & 0xff, (val >> 0) & 0xff }; 29 25 struct i2c_msg msg[1] = { 30 26 { 31 - .addr = priv->i2c_addr, 27 + .addr = client->addr, 32 28 .flags = 0, 33 29 .len = sizeof(buf), 34 30 .buf = buf, 35 31 } 36 32 }; 37 33 38 - ret = i2c_transfer(priv->i2c, msg, 1); 34 + ret = i2c_transfer(client->adapter, msg, 1); 39 35 if (ret == 1) { 40 36 ret = 0; 41 37 } else { 42 - dev_warn(&priv->i2c->dev, "%s: i2c wr failed=%d reg=%02x\n", 43 - KBUILD_MODNAME, ret, reg); 38 + dev_warn(&client->dev, "i2c wr failed=%d reg=%02x\n", ret, reg); 44 39 ret = -EREMOTEIO; 45 40 } 46 41 ··· 44 49 45 50 static int tua9001_init(struct dvb_frontend *fe) 46 51 { 47 - struct tua9001_priv *priv = fe->tuner_priv; 48 - int ret = 0; 49 - u8 i; 50 - struct reg_val data[] = { 51 - { 0x1e, 0x6512 }, 52 - { 0x25, 0xb888 }, 53 - { 0x39, 0x5460 }, 54 - { 0x3b, 0x00c0 }, 55 - { 0x3a, 0xf000 }, 56 - { 0x08, 0x0000 }, 57 - { 0x32, 0x0030 }, 58 - { 0x41, 0x703a }, 59 - { 0x40, 0x1c78 }, 60 - { 0x2c, 0x1c00 }, 61 - { 0x36, 0xc013 }, 62 - { 0x37, 0x6f18 }, 63 - { 0x27, 0x0008 }, 64 - { 0x2a, 0x0001 }, 65 - { 0x34, 0x0a40 }, 52 + struct tua9001_dev *dev = fe->tuner_priv; 53 + struct i2c_client *client = dev->client; 54 + int ret, i; 55 + static const struct tua9001_reg_val data[] = { 56 + {0x1e, 0x6512}, 57 + {0x25, 0xb888}, 58 + {0x39, 0x5460}, 59 + {0x3b, 0x00c0}, 60 + {0x3a, 0xf000}, 61 + {0x08, 0x0000}, 62 + {0x32, 0x0030}, 63 + {0x41, 0x703a}, 64 + {0x40, 0x1c78}, 65 + {0x2c, 0x1c00}, 66 + {0x36, 0xc013}, 67 + {0x37, 0x6f18}, 68 + {0x27, 0x0008}, 69 + {0x2a, 0x0001}, 70 + {0x34, 0x0a40}, 66 71 }; 67 72 68 - dev_dbg(&priv->i2c->dev, "%s:\n", __func__); 73 + dev_dbg(&client->dev, "\n"); 69 74 70 75 if (fe->callback) { 71 - ret = fe->callback(priv->i2c, DVB_FRONTEND_COMPONENT_TUNER, 72 - TUA9001_CMD_RESETN, 0); 73 - if (ret < 0) 76 + ret = fe->callback(client->adapter, 77 + DVB_FRONTEND_COMPONENT_TUNER, 78 + TUA9001_CMD_RESETN, 0); 79 + if (ret) 74 80 goto err; 75 81 } 76 82 77 83 for (i = 0; i < ARRAY_SIZE(data); i++) { 78 - ret = tua9001_wr_reg(priv, data[i].reg, data[i].val); 79 - if (ret < 0) 84 + ret = tua9001_wr_reg(dev, data[i].reg, data[i].val); 85 + if (ret) 80 86 goto err; 81 87 } 88 + return 0; 82 89 err: 83 - if (ret < 0) 84 - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); 85 - 90 + dev_dbg(&client->dev, "failed=%d\n", ret); 86 91 return ret; 87 92 } 88 93 89 94 static int tua9001_sleep(struct dvb_frontend *fe) 90 95 { 91 - struct tua9001_priv *priv = fe->tuner_priv; 92 - int ret = 0; 96 + struct tua9001_dev *dev = fe->tuner_priv; 97 + struct i2c_client *client = dev->client; 98 + int ret; 93 99 94 - dev_dbg(&priv->i2c->dev, "%s:\n", __func__); 100 + dev_dbg(&client->dev, "\n"); 95 101 96 - if (fe->callback) 97 - ret = fe->callback(priv->i2c, DVB_FRONTEND_COMPONENT_TUNER, 98 - TUA9001_CMD_RESETN, 1); 99 - 100 - if (ret < 0) 101 - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); 102 - 102 + if (fe->callback) { 103 + ret = fe->callback(client->adapter, 104 + DVB_FRONTEND_COMPONENT_TUNER, 105 + TUA9001_CMD_RESETN, 1); 106 + if (ret) 107 + goto err; 108 + } 109 + return 0; 110 + err: 111 + dev_dbg(&client->dev, "failed=%d\n", ret); 103 112 return ret; 104 113 } 105 114 106 115 static int tua9001_set_params(struct dvb_frontend *fe) 107 116 { 108 - struct tua9001_priv *priv = fe->tuner_priv; 117 + struct tua9001_dev *dev = fe->tuner_priv; 118 + struct i2c_client *client = dev->client; 109 119 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 110 - int ret = 0, i; 120 + int ret, i; 111 121 u16 val; 112 122 u32 frequency; 113 - struct reg_val data[2]; 123 + struct tua9001_reg_val data[2]; 114 124 115 - dev_dbg(&priv->i2c->dev, "%s: delivery_system=%d frequency=%d " \ 116 - "bandwidth_hz=%d\n", __func__, 117 - c->delivery_system, c->frequency, c->bandwidth_hz); 125 + dev_dbg(&client->dev, 126 + "delivery_system=%u frequency=%u bandwidth_hz=%u\n", 127 + c->delivery_system, c->frequency, c->bandwidth_hz); 118 128 119 129 switch (c->delivery_system) { 120 130 case SYS_DVBT: ··· 158 158 data[1].val = frequency; 159 159 160 160 if (fe->callback) { 161 - ret = fe->callback(priv->i2c, DVB_FRONTEND_COMPONENT_TUNER, 162 - TUA9001_CMD_RXEN, 0); 163 - if (ret < 0) 161 + ret = fe->callback(client->adapter, 162 + DVB_FRONTEND_COMPONENT_TUNER, 163 + TUA9001_CMD_RXEN, 0); 164 + if (ret) 164 165 goto err; 165 166 } 166 167 167 168 for (i = 0; i < ARRAY_SIZE(data); i++) { 168 - ret = tua9001_wr_reg(priv, data[i].reg, data[i].val); 169 - if (ret < 0) 169 + ret = tua9001_wr_reg(dev, data[i].reg, data[i].val); 170 + if (ret) 170 171 goto err; 171 172 } 172 173 173 174 if (fe->callback) { 174 - ret = fe->callback(priv->i2c, DVB_FRONTEND_COMPONENT_TUNER, 175 - TUA9001_CMD_RXEN, 1); 176 - if (ret < 0) 175 + ret = fe->callback(client->adapter, 176 + DVB_FRONTEND_COMPONENT_TUNER, 177 + TUA9001_CMD_RXEN, 1); 178 + if (ret) 177 179 goto err; 178 180 } 181 + return 0; 179 182 err: 180 - if (ret < 0) 181 - dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret); 182 - 183 + dev_dbg(&client->dev, "failed=%d\n", ret); 183 184 return ret; 184 185 } 185 186 186 187 static int tua9001_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) 187 188 { 188 - struct tua9001_priv *priv = fe->tuner_priv; 189 + struct tua9001_dev *dev = fe->tuner_priv; 190 + struct i2c_client *client = dev->client; 189 191 190 - dev_dbg(&priv->i2c->dev, "%s:\n", __func__); 192 + dev_dbg(&client->dev, "\n"); 191 193 192 194 *frequency = 0; /* Zero-IF */ 193 - 194 195 return 0; 195 196 } 196 197 197 198 static const struct dvb_tuner_ops tua9001_tuner_ops = { 198 199 .info = { 199 - .name = "Infineon TUA 9001", 200 - 200 + .name = "Infineon TUA9001", 201 201 .frequency_min = 170000000, 202 202 .frequency_max = 862000000, 203 - .frequency_step = 0, 204 203 }, 205 204 206 205 .init = tua9001_init, ··· 212 213 static int tua9001_probe(struct i2c_client *client, 213 214 const struct i2c_device_id *id) 214 215 { 215 - struct tua9001_priv *dev; 216 + struct tua9001_dev *dev; 216 217 struct tua9001_platform_data *pdata = client->dev.platform_data; 217 218 struct dvb_frontend *fe = pdata->dvb_frontend; 218 219 int ret; ··· 224 225 } 225 226 226 227 dev->client = client; 227 - dev->i2c_addr = client->addr; 228 - dev->i2c = client->adapter; 229 228 dev->fe = pdata->dvb_frontend; 230 229 231 230 if (fe->callback) { ··· 251 254 sizeof(struct dvb_tuner_ops)); 252 255 i2c_set_clientdata(client, dev); 253 256 254 - dev_info(&client->dev, "Infineon TUA 9001 successfully attached\n"); 257 + dev_info(&client->dev, "Infineon TUA9001 successfully attached\n"); 255 258 return 0; 256 259 err_kfree: 257 260 kfree(dev); ··· 262 265 263 266 static int tua9001_remove(struct i2c_client *client) 264 267 { 265 - struct tua9001_priv *dev = i2c_get_clientdata(client); 268 + struct tua9001_dev *dev = i2c_get_clientdata(client); 266 269 struct dvb_frontend *fe = dev->fe; 267 270 int ret; 268 271 ··· 302 305 303 306 module_i2c_driver(tua9001_driver); 304 307 305 - MODULE_DESCRIPTION("Infineon TUA 9001 silicon tuner driver"); 308 + MODULE_DESCRIPTION("Infineon TUA9001 silicon tuner driver"); 306 309 MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 307 310 MODULE_LICENSE("GPL");
+1 -5
drivers/media/tuners/tua9001.h
··· 1 1 /* 2 - * Infineon TUA 9001 silicon tuner driver 2 + * Infineon TUA9001 silicon tuner driver 3 3 * 4 4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi> 5 5 * ··· 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License along 17 - * with this program; if not, write to the Free Software Foundation, Inc., 18 - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 15 */ 20 16 21 17 #ifndef TUA9001_H
+6 -10
drivers/media/tuners/tua9001_priv.h
··· 1 1 /* 2 - * Infineon TUA 9001 silicon tuner driver 2 + * Infineon TUA9001 silicon tuner driver 3 3 * 4 4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi> 5 5 * ··· 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License along 17 - * with this program; if not, write to the Free Software Foundation, Inc., 18 - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 15 */ 20 16 21 17 #ifndef TUA9001_PRIV_H 22 18 #define TUA9001_PRIV_H 23 19 24 - struct reg_val { 20 + #include "tua9001.h" 21 + 22 + struct tua9001_reg_val { 25 23 u8 reg; 26 24 u16 val; 27 25 }; 28 26 29 - struct tua9001_priv { 30 - struct i2c_client *client; 31 - struct i2c_adapter *i2c; 32 - u8 i2c_addr; 27 + struct tua9001_dev { 33 28 struct dvb_frontend *fe; 29 + struct i2c_client *client; 34 30 }; 35 31 36 32 #endif