Lines Matching refs:pdev

286  * @pdev:	Pointer to the driver data
289 static int idt_smb_write_byte(struct idt_89hpesx_dev *pdev,
306 sts = idt_smb_safe(write_byte, pdev->client, ccode,
318 * @pdev: Pointer to the driver data
321 static int idt_smb_read_byte(struct idt_89hpesx_dev *pdev,
338 sts = idt_smb_safe(read_byte, pdev->client, ccode);
351 * @pdev: Pointer to the driver data
354 static int idt_smb_write_word(struct idt_89hpesx_dev *pdev,
374 sts = idt_smb_safe(write_word, pdev->client, ccode,
388 sts = idt_smb_safe(write_byte, pdev->client, ccode,
400 * @pdev: Pointer to the driver data
403 static int idt_smb_read_word(struct idt_89hpesx_dev *pdev,
423 sts = idt_smb_safe(read_word, pdev->client, ccode);
438 sts = idt_smb_safe(read_byte, pdev->client, ccode);
451 * @pdev: Pointer to the driver data
454 static int idt_smb_write_block(struct idt_89hpesx_dev *pdev,
467 return idt_smb_safe(write_block, pdev->client, ccode, seq->bytecnt,
474 * @pdev: Pointer to the driver data
477 static int idt_smb_read_block(struct idt_89hpesx_dev *pdev,
491 sts = idt_smb_safe(read_block, pdev->client, ccode, seq->data);
501 * @pdev: Pointer to the driver data
507 static int idt_smb_write_i2c_block(struct idt_89hpesx_dev *pdev,
524 return idt_smb_safe(write_i2c_block, pdev->client, ccode,
531 * @pdev: Pointer to the driver data
537 static int idt_smb_read_i2c_block(struct idt_89hpesx_dev *pdev,
551 sts = idt_smb_safe(read_i2c_block, pdev->client, ccode,
571 * @pdev: Pointer to the driver data
575 static int idt_eeprom_read_byte(struct idt_89hpesx_dev *pdev, u16 memaddr,
578 struct device *dev = &pdev->client->dev;
584 smbseq.ccode = pdev->iniccode | CCODE_EEPROM;
595 eeseq.cmd = pdev->inieecmd | EEPROM_OP_READ;
596 eeseq.eeaddr = pdev->eeaddr;
598 ret = pdev->smb_write(pdev, &smbseq);
607 ret = pdev->smb_read(pdev, &smbseq);
642 * @pdev: Pointer to the driver data
647 static int idt_eeprom_write(struct idt_89hpesx_dev *pdev, u16 memaddr, u16 len,
650 struct device *dev = &pdev->client->dev;
657 smbseq.ccode = pdev->iniccode | CCODE_EEPROM;
663 mutex_lock(&pdev->smb_mtx);
667 eeseq.cmd = pdev->inieecmd | EEPROM_OP_WRITE;
668 eeseq.eeaddr = pdev->eeaddr;
671 ret = pdev->smb_write(pdev, &smbseq);
684 ret = idt_eeprom_read_byte(pdev, memaddr, &eeseq.data);
698 mutex_unlock(&pdev->smb_mtx);
708 * @pdev: Pointer to the driver data
713 static int idt_eeprom_read(struct idt_89hpesx_dev *pdev, u16 memaddr, u16 len,
722 mutex_lock(&pdev->smb_mtx);
725 ret = idt_eeprom_read_byte(pdev, memaddr, &buf[idx]);
728 mutex_unlock(&pdev->smb_mtx);
745 * @pdev: Pointer to the driver data
749 static int idt_csr_write(struct idt_89hpesx_dev *pdev, u16 csraddr,
752 struct device *dev = &pdev->client->dev;
758 smbseq.ccode = pdev->iniccode | CCODE_CSR;
762 mutex_lock(&pdev->smb_mtx);
766 csrseq.cmd = pdev->inicsrcmd | CSR_OP_WRITE;
769 ret = pdev->smb_write(pdev, &smbseq);
778 csrseq.cmd = pdev->inicsrcmd | CSR_OP_READ;
779 ret = pdev->smb_write(pdev, &smbseq);
788 ret = pdev->smb_read(pdev, &smbseq);
804 mutex_unlock(&pdev->smb_mtx);
811 * @pdev: Pointer to the driver data
815 static int idt_csr_read(struct idt_89hpesx_dev *pdev, u16 csraddr, u32 *data)
817 struct device *dev = &pdev->client->dev;
823 smbseq.ccode = pdev->iniccode | CCODE_CSR;
827 mutex_lock(&pdev->smb_mtx);
831 csrseq.cmd = pdev->inicsrcmd | CSR_OP_READ;
833 ret = pdev->smb_write(pdev, &smbseq);
842 ret = pdev->smb_read(pdev, &smbseq);
861 mutex_unlock(&pdev->smb_mtx);
884 struct idt_89hpesx_dev *pdev;
888 pdev = dev_get_drvdata(kobj_to_dev(kobj));
891 ret = idt_eeprom_write(pdev, (u16)off, (u16)count, (u8 *)buf);
908 struct idt_89hpesx_dev *pdev;
912 pdev = dev_get_drvdata(kobj_to_dev(kobj));
915 ret = idt_eeprom_read(pdev, (u16)off, (u16)count, (u8 *)buf);
937 struct idt_89hpesx_dev *pdev = filep->private_data;
997 pdev->csr = (csraddr >> 2);
1005 ret = idt_csr_write(pdev, pdev->csr, csrval);
1035 struct idt_89hpesx_dev *pdev = filep->private_data;
1041 ret = idt_csr_read(pdev, pdev->csr, &csrval);
1046 csraddr = ((u32)pdev->csr << 2);
1081 * @pdev: Pointer to the driver data
1083 static void idt_set_defval(struct idt_89hpesx_dev *pdev)
1086 pdev->eesize = 0;
1087 pdev->eero = true;
1088 pdev->inieecmd = 0;
1089 pdev->eeaddr = 0;
1121 * @pdev: Pointer to the driver data
1123 static void idt_get_fw_data(struct idt_89hpesx_dev *pdev)
1125 struct device *dev = &pdev->client->dev;
1142 idt_set_defval(pdev);
1147 pdev->eesize = (u32)ee_id->driver_data;
1154 pdev->inieecmd = 0;
1155 pdev->eeaddr = EEPROM_DEF_ADDR << 1;
1157 pdev->inieecmd = EEPROM_USA;
1158 pdev->eeaddr = eeprom_addr << 1;
1163 pdev->eero = true;
1165 pdev->eero = false;
1169 pdev->eesize, pdev->eeaddr);
1178 struct idt_89hpesx_dev *pdev;
1181 pdev = devm_kmalloc(&client->dev, sizeof(struct idt_89hpesx_dev),
1183 if (pdev == NULL)
1187 pdev->client = client;
1188 i2c_set_clientdata(client, pdev);
1191 idt_get_fw_data(pdev);
1194 pdev->inicsrcmd = CSR_DWE;
1195 pdev->csr = CSR_DEF;
1199 pdev->iniccode = CCODE_PEC;
1202 pdev->iniccode = 0;
1205 return pdev;
1210 * @pdev: Pointer to the driver data
1212 static void idt_free_pdev(struct idt_89hpesx_dev *pdev)
1215 i2c_set_clientdata(pdev->client, NULL);
1220 * @pdev: Pointer to the driver data
1223 static int idt_set_smbus_ops(struct idt_89hpesx_dev *pdev)
1225 struct i2c_adapter *adapter = pdev->client->adapter;
1226 struct device *dev = &pdev->client->dev;
1231 pdev->smb_read = idt_smb_read_block;
1235 pdev->smb_read = idt_smb_read_i2c_block;
1241 pdev->smb_read = idt_smb_read_word;
1245 pdev->smb_read = idt_smb_read_byte;
1255 pdev->smb_write = idt_smb_write_block;
1259 pdev->smb_write = idt_smb_write_i2c_block;
1265 pdev->smb_write = idt_smb_write_word;
1269 pdev->smb_write = idt_smb_write_byte;
1277 mutex_init(&pdev->smb_mtx);
1284 * @pdev: Pointer to the driver data
1287 static int idt_check_dev(struct idt_89hpesx_dev *pdev)
1289 struct device *dev = &pdev->client->dev;
1294 ret = idt_csr_read(pdev, IDT_VIDDID_CSR, &viddid);
1314 * @pdev: Pointer to the driver data
1317 static int idt_create_sysfs_files(struct idt_89hpesx_dev *pdev)
1319 struct device *dev = &pdev->client->dev;
1323 if (pdev->eesize == 0) {
1329 pdev->ee_file = devm_kmalloc(dev, sizeof(*pdev->ee_file), GFP_KERNEL);
1330 if (!pdev->ee_file)
1334 memcpy(pdev->ee_file, &bin_attr_eeprom, sizeof(*pdev->ee_file));
1337 if (pdev->eero) {
1338 pdev->ee_file->attr.mode &= ~0200;
1339 pdev->ee_file->write = NULL;
1342 pdev->ee_file->size = pdev->eesize;
1343 ret = sysfs_create_bin_file(&dev->kobj, pdev->ee_file);
1354 * @pdev: Pointer to the driver data
1356 static void idt_remove_sysfs_files(struct idt_89hpesx_dev *pdev)
1358 struct device *dev = &pdev->client->dev;
1361 if (pdev->eesize == 0)
1365 sysfs_remove_bin_file(&dev->kobj, pdev->ee_file);
1370 * @pdev: Pointer to the driver data
1373 static void idt_create_dbgfs_files(struct idt_89hpesx_dev *pdev)
1375 struct i2c_client *cli = pdev->client;
1380 pdev->csr_dir = debugfs_create_dir(fname, csr_dbgdir);
1383 debugfs_create_file(cli->name, 0600, pdev->csr_dir, pdev,
1389 * @pdev: Pointer to the driver data
1391 static void idt_remove_dbgfs_files(struct idt_89hpesx_dev *pdev)
1394 debugfs_remove_recursive(pdev->csr_dir);
1402 struct idt_89hpesx_dev *pdev;
1406 pdev = idt_create_pdev(client);
1407 if (IS_ERR(pdev))
1408 return PTR_ERR(pdev);
1411 ret = idt_set_smbus_ops(pdev);
1416 ret = idt_check_dev(pdev);
1421 ret = idt_create_sysfs_files(pdev);
1426 idt_create_dbgfs_files(pdev);
1431 idt_free_pdev(pdev);
1441 struct idt_89hpesx_dev *pdev = i2c_get_clientdata(client);
1444 idt_remove_dbgfs_files(pdev);
1447 idt_remove_sysfs_files(pdev);
1450 idt_free_pdev(pdev);