Lines Matching +full:open +full:- +full:circuit
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2007-2009 ST-Ericsson AB
6 * Driver to read out OTP from the AB3100 Mixed-signal circuit
35 * to change bits from 1->0.
68 err = abx500_get_register_interruptible(otp->dev, 0, in ab3100_otp_read()
71 dev_err(otp->dev, "unable to read OTPP register\n"); in ab3100_otp_read()
75 err = abx500_get_register_page_interruptible(otp->dev, 0, in ab3100_otp_read()
78 dev_err(otp->dev, "unable to read OTP register page\n"); in ab3100_otp_read()
83 otp->locked = (otpp & 0x80); in ab3100_otp_read()
84 otp->freq = (otpp & 0x40) ? 32768 : 34100; in ab3100_otp_read()
85 otp->paf = (otpval[1] & 0x80); in ab3100_otp_read()
86 otp->imeich = (otpval[1] & 0x40); in ab3100_otp_read()
87 otp->cid = ((otpval[1] << 8) | otpval[0]) & 0x3fff; in ab3100_otp_read()
88 otp->tac = ((otpval[4] & 0x0f) << 16) | (otpval[3] << 8) | otpval[2]; in ab3100_otp_read()
89 otp->fac = ((otpval[5] & 0x0f) << 4) | (otpval[4] >> 4); in ab3100_otp_read()
90 otp->svn = (otpval[7] << 12) | (otpval[6] << 4) | (otpval[5] >> 4); in ab3100_otp_read()
95 * This is a simple debugfs human-readable file that dumps out
101 struct ab3100_otp *otp = s->private; in ab3100_show_otp()
103 seq_printf(s, "OTP is %s\n", otp->locked ? "LOCKED" : "UNLOCKED"); in ab3100_show_otp()
104 seq_printf(s, "OTP clock switch startup is %uHz\n", otp->freq); in ab3100_show_otp()
105 seq_printf(s, "PAF is %s\n", otp->paf ? "SET" : "NOT SET"); in ab3100_show_otp()
106 seq_printf(s, "IMEI is %s\n", otp->imeich ? in ab3100_show_otp()
108 seq_printf(s, "CID: 0x%04x (decimal: %d)\n", otp->cid, otp->cid); in ab3100_show_otp()
109 seq_printf(s, "IMEI: %u-%u-%u\n", otp->tac, otp->fac, otp->svn); in ab3100_show_otp()
115 return single_open(file, ab3100_show_otp, inode->i_private); in ab3100_otp_open()
119 .open = ab3100_otp_open,
128 otp->debugfs = debugfs_create_file("ab3100_otp", S_IFREG | S_IRUGO, in ab3100_otp_init_debugfs()
134 debugfs_remove(otp->debugfs); in ab3100_otp_exit_debugfs()
154 return sprintf(buf, "%u\n", otp->name); \
183 otp = devm_kzalloc(&pdev->dev, sizeof(struct ab3100_otp), GFP_KERNEL); in ab3100_otp_probe()
185 return -ENOMEM; in ab3100_otp_probe()
187 otp->dev = &pdev->dev; in ab3100_otp_probe()
196 dev_info(&pdev->dev, "AB3100 OTP readout registered\n"); in ab3100_otp_probe()
200 err = device_create_file(&pdev->dev, in ab3100_otp_probe()
207 ab3100_otp_init_debugfs(&pdev->dev, otp); in ab3100_otp_probe()
212 while (--i >= 0) in ab3100_otp_probe()
213 device_remove_file(&pdev->dev, &ab3100_otp_attrs[i]); in ab3100_otp_probe()
223 device_remove_file(&pdev->dev, in ab3100_otp_remove()
231 .name = "ab3100-otp",