• Home
  • Raw
  • Download

Lines Matching refs:cpcap

61 static int cpcap_check_revision(struct cpcap_ddata *cpcap)  in cpcap_check_revision()  argument
66 ret = cpcap_get_vendor(&cpcap->spi->dev, cpcap->regmap, &vendor); in cpcap_check_revision()
70 ret = cpcap_get_revision(&cpcap->spi->dev, cpcap->regmap, &rev); in cpcap_check_revision()
74 dev_info(&cpcap->spi->dev, "CPCAP vendor: %s rev: %i.%i (%x)\n", in cpcap_check_revision()
80 dev_info(&cpcap->spi->dev, in cpcap_check_revision()
122 static void cpcap_init_one_regmap_irq(struct cpcap_ddata *cpcap, in cpcap_init_one_regmap_irq() argument
130 reg_offset /= cpcap->regmap_conf->val_bits; in cpcap_init_one_regmap_irq()
131 reg_offset *= cpcap->regmap_conf->reg_stride; in cpcap_init_one_regmap_irq()
133 bit = irq % cpcap->regmap_conf->val_bits; in cpcap_init_one_regmap_irq()
140 static int cpcap_init_irq_chip(struct cpcap_ddata *cpcap, int irq_chip, in cpcap_init_irq_chip() argument
147 struct regmap_irq *rirq = &cpcap->irqs[i]; in cpcap_init_irq_chip()
149 cpcap_init_one_regmap_irq(cpcap, rirq, irq_start, i); in cpcap_init_irq_chip()
151 chip->irqs = &cpcap->irqs[irq_start]; in cpcap_init_irq_chip()
153 chip->irq_drv_data = cpcap; in cpcap_init_irq_chip()
155 ret = devm_regmap_add_irq_chip(&cpcap->spi->dev, cpcap->regmap, in cpcap_init_irq_chip()
156 cpcap->spi->irq, in cpcap_init_irq_chip()
157 irq_get_trigger_type(cpcap->spi->irq) | in cpcap_init_irq_chip()
159 chip, &cpcap->irqdata[irq_chip]); in cpcap_init_irq_chip()
161 dev_err(&cpcap->spi->dev, "could not add irq chip %i: %i\n", in cpcap_init_irq_chip()
169 static int cpcap_init_irq(struct cpcap_ddata *cpcap) in cpcap_init_irq() argument
173 cpcap->irqs = devm_kzalloc(&cpcap->spi->dev, in cpcap_init_irq()
174 array3_size(sizeof(*cpcap->irqs), in cpcap_init_irq()
176 cpcap->regmap_conf->val_bits), in cpcap_init_irq()
178 if (!cpcap->irqs) in cpcap_init_irq()
181 ret = cpcap_init_irq_chip(cpcap, 0, 0, 16); in cpcap_init_irq()
185 ret = cpcap_init_irq_chip(cpcap, 1, 16, 16); in cpcap_init_irq()
189 ret = cpcap_init_irq_chip(cpcap, 2, 32, 64); in cpcap_init_irq()
193 enable_irq_wake(cpcap->spi->irq); in cpcap_init_irq()
289 struct cpcap_ddata *cpcap; in cpcap_probe() local
296 cpcap = devm_kzalloc(&spi->dev, sizeof(*cpcap), GFP_KERNEL); in cpcap_probe()
297 if (!cpcap) in cpcap_probe()
300 cpcap->spi = spi; in cpcap_probe()
301 spi_set_drvdata(spi, cpcap); in cpcap_probe()
310 cpcap->regmap_conf = &cpcap_regmap_config; in cpcap_probe()
311 cpcap->regmap = devm_regmap_init_spi(spi, &cpcap_regmap_config); in cpcap_probe()
312 if (IS_ERR(cpcap->regmap)) { in cpcap_probe()
313 ret = PTR_ERR(cpcap->regmap); in cpcap_probe()
314 dev_err(&cpcap->spi->dev, "Failed to initialize regmap: %d\n", in cpcap_probe()
320 ret = cpcap_check_revision(cpcap); in cpcap_probe()
322 dev_err(&cpcap->spi->dev, "Failed to detect CPCAP: %i\n", ret); in cpcap_probe()
326 ret = cpcap_init_irq(cpcap); in cpcap_probe()