Lines Matching refs:pdev

255  * @pdev:	Pointer to the driver data
258 static int idt_smb_write_byte(struct idt_89hpesx_dev *pdev,
275 sts = idt_smb_safe(write_byte, pdev->client, ccode,
287 * @pdev: Pointer to the driver data
290 static int idt_smb_read_byte(struct idt_89hpesx_dev *pdev,
307 sts = idt_smb_safe(read_byte, pdev->client, ccode);
320 * @pdev: Pointer to the driver data
323 static int idt_smb_write_word(struct idt_89hpesx_dev *pdev,
343 sts = idt_smb_safe(write_word, pdev->client, ccode,
357 sts = idt_smb_safe(write_byte, pdev->client, ccode,
369 * @pdev: Pointer to the driver data
372 static int idt_smb_read_word(struct idt_89hpesx_dev *pdev,
392 sts = idt_smb_safe(read_word, pdev->client, ccode);
407 sts = idt_smb_safe(read_byte, pdev->client, ccode);
420 * @pdev: Pointer to the driver data
423 static int idt_smb_write_block(struct idt_89hpesx_dev *pdev,
436 return idt_smb_safe(write_block, pdev->client, ccode, seq->bytecnt,
443 * @pdev: Pointer to the driver data
446 static int idt_smb_read_block(struct idt_89hpesx_dev *pdev,
460 sts = idt_smb_safe(read_block, pdev->client, ccode, seq->data);
470 * @pdev: Pointer to the driver data
476 static int idt_smb_write_i2c_block(struct idt_89hpesx_dev *pdev,
493 return idt_smb_safe(write_i2c_block, pdev->client, ccode,
500 * @pdev: Pointer to the driver data
506 static int idt_smb_read_i2c_block(struct idt_89hpesx_dev *pdev,
520 sts = idt_smb_safe(read_i2c_block, pdev->client, ccode,
540 * @pdev: Pointer to the driver data
544 static int idt_eeprom_read_byte(struct idt_89hpesx_dev *pdev, u16 memaddr,
547 struct device *dev = &pdev->client->dev;
553 smbseq.ccode = pdev->iniccode | CCODE_EEPROM;
564 eeseq.cmd = pdev->inieecmd | EEPROM_OP_READ;
565 eeseq.eeaddr = pdev->eeaddr;
567 ret = pdev->smb_write(pdev, &smbseq);
576 ret = pdev->smb_read(pdev, &smbseq);
611 * @pdev: Pointer to the driver data
616 static int idt_eeprom_write(struct idt_89hpesx_dev *pdev, u16 memaddr, u16 len,
619 struct device *dev = &pdev->client->dev;
626 smbseq.ccode = pdev->iniccode | CCODE_EEPROM;
632 mutex_lock(&pdev->smb_mtx);
636 eeseq.cmd = pdev->inieecmd | EEPROM_OP_WRITE;
637 eeseq.eeaddr = pdev->eeaddr;
640 ret = pdev->smb_write(pdev, &smbseq);
653 ret = idt_eeprom_read_byte(pdev, memaddr, &eeseq.data);
667 mutex_unlock(&pdev->smb_mtx);
677 * @pdev: Pointer to the driver data
682 static int idt_eeprom_read(struct idt_89hpesx_dev *pdev, u16 memaddr, u16 len,
691 mutex_lock(&pdev->smb_mtx);
694 ret = idt_eeprom_read_byte(pdev, memaddr, &buf[idx]);
697 mutex_unlock(&pdev->smb_mtx);
714 * @pdev: Pointer to the driver data
718 static int idt_csr_write(struct idt_89hpesx_dev *pdev, u16 csraddr,
721 struct device *dev = &pdev->client->dev;
727 smbseq.ccode = pdev->iniccode | CCODE_CSR;
731 mutex_lock(&pdev->smb_mtx);
735 csrseq.cmd = pdev->inicsrcmd | CSR_OP_WRITE;
738 ret = pdev->smb_write(pdev, &smbseq);
747 csrseq.cmd = pdev->inicsrcmd | CSR_OP_READ;
748 ret = pdev->smb_write(pdev, &smbseq);
757 ret = pdev->smb_read(pdev, &smbseq);
773 mutex_unlock(&pdev->smb_mtx);
780 * @pdev: Pointer to the driver data
784 static int idt_csr_read(struct idt_89hpesx_dev *pdev, u16 csraddr, u32 *data)
786 struct device *dev = &pdev->client->dev;
792 smbseq.ccode = pdev->iniccode | CCODE_CSR;
796 mutex_lock(&pdev->smb_mtx);
800 csrseq.cmd = pdev->inicsrcmd | CSR_OP_READ;
802 ret = pdev->smb_write(pdev, &smbseq);
811 ret = pdev->smb_read(pdev, &smbseq);
830 mutex_unlock(&pdev->smb_mtx);
853 struct idt_89hpesx_dev *pdev;
857 pdev = dev_get_drvdata(kobj_to_dev(kobj));
860 ret = idt_eeprom_write(pdev, (u16)off, (u16)count, (u8 *)buf);
877 struct idt_89hpesx_dev *pdev;
881 pdev = dev_get_drvdata(kobj_to_dev(kobj));
884 ret = idt_eeprom_read(pdev, (u16)off, (u16)count, (u8 *)buf);
906 struct idt_89hpesx_dev *pdev = filep->private_data;
960 pdev->csr = (csraddr >> 2);
968 ret = idt_csr_write(pdev, pdev->csr, csrval);
998 struct idt_89hpesx_dev *pdev = filep->private_data;
1004 ret = idt_csr_read(pdev, pdev->csr, &csrval);
1009 csraddr = ((u32)pdev->csr << 2);
1044 * @pdev: Pointer to the driver data
1046 static void idt_set_defval(struct idt_89hpesx_dev *pdev)
1049 pdev->eesize = 0;
1050 pdev->eero = true;
1051 pdev->inieecmd = 0;
1052 pdev->eeaddr = 0;
1084 * @pdev: Pointer to the driver data
1086 static void idt_get_fw_data(struct idt_89hpesx_dev *pdev)
1088 struct device *dev = &pdev->client->dev;
1105 idt_set_defval(pdev);
1110 pdev->eesize = (u32)ee_id->driver_data;
1117 pdev->inieecmd = 0;
1118 pdev->eeaddr = EEPROM_DEF_ADDR << 1;
1120 pdev->inieecmd = EEPROM_USA;
1121 pdev->eeaddr = eeprom_addr << 1;
1126 pdev->eero = true;
1128 pdev->eero = false;
1132 pdev->eesize, pdev->eeaddr);
1141 struct idt_89hpesx_dev *pdev;
1144 pdev = devm_kmalloc(&client->dev, sizeof(struct idt_89hpesx_dev),
1146 if (pdev == NULL)
1150 pdev->client = client;
1151 i2c_set_clientdata(client, pdev);
1154 idt_get_fw_data(pdev);
1157 pdev->inicsrcmd = CSR_DWE;
1158 pdev->csr = CSR_DEF;
1162 pdev->iniccode = CCODE_PEC;
1165 pdev->iniccode = 0;
1168 return pdev;
1173 * @pdev: Pointer to the driver data
1175 static void idt_free_pdev(struct idt_89hpesx_dev *pdev)
1178 i2c_set_clientdata(pdev->client, NULL);
1183 * @pdev: Pointer to the driver data
1186 static int idt_set_smbus_ops(struct idt_89hpesx_dev *pdev)
1188 struct i2c_adapter *adapter = pdev->client->adapter;
1189 struct device *dev = &pdev->client->dev;
1194 pdev->smb_read = idt_smb_read_block;
1198 pdev->smb_read = idt_smb_read_i2c_block;
1204 pdev->smb_read = idt_smb_read_word;
1208 pdev->smb_read = idt_smb_read_byte;
1218 pdev->smb_write = idt_smb_write_block;
1222 pdev->smb_write = idt_smb_write_i2c_block;
1228 pdev->smb_write = idt_smb_write_word;
1232 pdev->smb_write = idt_smb_write_byte;
1240 mutex_init(&pdev->smb_mtx);
1247 * @pdev: Pointer to the driver data
1250 static int idt_check_dev(struct idt_89hpesx_dev *pdev)
1252 struct device *dev = &pdev->client->dev;
1257 ret = idt_csr_read(pdev, IDT_VIDDID_CSR, &viddid);
1277 * @pdev: Pointer to the driver data
1280 static int idt_create_sysfs_files(struct idt_89hpesx_dev *pdev)
1282 struct device *dev = &pdev->client->dev;
1286 if (pdev->eesize == 0) {
1295 pdev->ee_file = devm_kmemdup(dev, &bin_attr_eeprom,
1296 sizeof(*pdev->ee_file), GFP_KERNEL);
1297 if (!pdev->ee_file)
1301 if (pdev->eero) {
1302 pdev->ee_file->attr.mode &= ~0200;
1303 pdev->ee_file->write = NULL;
1306 pdev->ee_file->size = pdev->eesize;
1307 ret = sysfs_create_bin_file(&dev->kobj, pdev->ee_file);
1318 * @pdev: Pointer to the driver data
1320 static void idt_remove_sysfs_files(struct idt_89hpesx_dev *pdev)
1322 struct device *dev = &pdev->client->dev;
1325 if (pdev->eesize == 0)
1329 sysfs_remove_bin_file(&dev->kobj, pdev->ee_file);
1334 * @pdev: Pointer to the driver data
1337 static void idt_create_dbgfs_files(struct idt_89hpesx_dev *pdev)
1339 struct i2c_client *cli = pdev->client;
1344 pdev->csr_dir = debugfs_create_dir(fname, csr_dbgdir);
1347 debugfs_create_file(cli->name, 0600, pdev->csr_dir, pdev,
1353 * @pdev: Pointer to the driver data
1355 static void idt_remove_dbgfs_files(struct idt_89hpesx_dev *pdev)
1358 debugfs_remove_recursive(pdev->csr_dir);
1366 struct idt_89hpesx_dev *pdev;
1370 pdev = idt_create_pdev(client);
1371 if (IS_ERR(pdev))
1372 return PTR_ERR(pdev);
1375 ret = idt_set_smbus_ops(pdev);
1380 ret = idt_check_dev(pdev);
1385 ret = idt_create_sysfs_files(pdev);
1390 idt_create_dbgfs_files(pdev);
1395 idt_free_pdev(pdev);
1405 struct idt_89hpesx_dev *pdev = i2c_get_clientdata(client);
1408 idt_remove_dbgfs_files(pdev);
1411 idt_remove_sysfs_files(pdev);
1414 idt_free_pdev(pdev);